...to ignore some fields for rejecting nested records (e.g. hidden input fields). class Post < ActiveRecord::Base has_many :comments accepts_nested_attributes_for :comments, :reject_if => all_blank_except(:position...
Now you can say: class Song < ActiveRecord::Base attr_accessor :virtual_attribute assignable_values_for :virtual_attribute do %w[air fluff] end
...your model to have it automatically strip all :string fields before validation: class Organisation < ActiveRecord::Base validates_presence_of :name, :city, :phone, :website, .... does 'strip_string_fields' end
...order to whitelist #id on a model of your choice like this: class MyModel < ActiveRecord::Base include AllowSettingIdOnCreate end Note that your controllers should always whitelist the attributes they set...