Skip to content

Instantly share code, notes, and snippets.

@softwaregravy
Created August 30, 2011 03:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save softwaregravy/1180082 to your computer and use it in GitHub Desktop.
Save softwaregravy/1180082 to your computer and use it in GitHub Desktop.
The controller cleanup
def update
@my_model = MyModel.find_by_id(params[:id])
params[:my_model].try(:[], "my_value_array").try(:reject!){|v| v.blank? }
if @my_model.update_attributes(params[:my_model])
# blah blah blah
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment