Skip to content

Instantly share code, notes, and snippets.

@bloudermilk
Created October 19, 2012 20:11
Show Gist options
  • Save bloudermilk/3920398 to your computer and use it in GitHub Desktop.
Save bloudermilk/3920398 to your computer and use it in GitHub Desktop.
Allow mass-assignment of type attribute in Rails
class MyModel < ActiveRecord::Base
private
# Allow mass-assignment of the type attribute
def self.attributes_protected_by_default
super - %W[ type ]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment