I have the following Rails model:
class CreateFoo < ActiveRecord::Migration def self.up create_table :foo do |t| t.string :a t.string :b
I use this frequently (simplified):
params.select!{|x| Model.attribute_names.index(x)} Model.update_attributes(params)