Created
December 14, 2011 02:15
-
-
Save mgreenly/1474920 to your computer and use it in GitHub Desktop.
ignore column in active record
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
@@ignore_attr = ['lname'] | |
def arel_attributes_values(include_primary_key = true, include_readonly_attributes = true, attribute_names = @attributes.keys) | |
attrs = super(include_primary_key, include_readonly_attributes, attribute_names) | |
attrs.delete_if {|key,value| @@ignore_attr.include?(key.name) } | |
puts attrs.inspect | |
attrs | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment