if @image.update_attributes params[:product_image]
if request.xhr?
render :json => { :status => 'success', :data => {:message => I18n.t('product_image.results.reordered')} }
...
using System; using System.Collections.Generic; using System.Linq; ...
C# Problem with Login for Admi...
by tragicdancer.myopenid.com,
July 14, 2011 13:32,
1 refactoring, tagged with models, controller, login, C# asp.net-mvc, asp.net-mvc
I'm trying to implement a s...
def create
@lead = Lead.new(params[:lead])
@contact = @lead.contact_detail = ContactDetail.new(params[:contact_detail])
...
Ruby Best way to do this
by https://www.google.com/accounts/o8/id?id=AItOawl-DJ5xgYVFKrrLOGZqwCiGLkx38LeB1cU,
April 28, 2011 00:08,
6 refactorings, tagged with controller, rails3
Thanks
def search
@search = params[:company_search]
@results = Company.search @search, :include => :staff_id,
...
Ruby Messy if statements
by https://www.google.com/accounts/o8/id?id=AItOawkXhagloEt9LaGYb5TnfYmraHmMC8fzlsE,
March 22, 2011 00:55,
2 refactorings, tagged with rails, controller, sphinx
This works but it's messy. ...
def create allow_publish = logged_in? && @trend.allow_more_publishers?(params[:connection_id]) if allow_publish && !@trend.include_publisher?(params[:connection_id]) ...
Ruby what if I don't like too ma...
by edgarjs,
October 21, 2010 15:50,
4 refactorings, tagged with rails, conditions, associations, controller, create, build, ifs
I want to avoid the abuse o...
def create
@announcement = current_account.announcements.build(params[:announcement])
...
Ruby Re-Refactor Mailer Conditions
by fnjord.myopenid.com,
February 13, 2009 17:44,
2 refactorings, tagged with rails, ruby, conditions, controller, mailer
This is just a mess. It wou...
class PeopleController < ApplicationController ...
Ruby Re-use code for new and cre...
Hello,
I have a 'people'...
if @foo.update_attributes(params[:foo]) and @foo.bar.update_attributes(params[:bar])
redirect_to foo_url(@parent)
else
...
Ruby Saving multiple models in o...
What's the best way to save...
Any suggestions for DRYing ...