Module: ActiveRecord::AttributeMethods::ClassMethods
- Defined in:
- lib/brick/extensions.rb
Instance Method Summary collapse
- #_brick_dangerous_attribute_method? ⇒ Object
-
#dangerous_attribute_method?(name) ⇒ Boolean
Bypass the error “ActiveRecord::DangerousAttributeError” if this object comes from a view.
Instance Method Details
#_brick_dangerous_attribute_method? ⇒ Object
501 |
# File 'lib/brick/extensions.rb', line 501 alias _brick_dangerous_attribute_method? dangerous_attribute_method? |
#dangerous_attribute_method?(name) ⇒ Boolean
Bypass the error “ActiveRecord::DangerousAttributeError” if this object comes from a view. (Allows for column names such as ‘attribute’, ‘delete’, and ‘update’ to still work.)
504 505 506 507 508 509 510 511 512 |
# File 'lib/brick/extensions.rb', line 504 def dangerous_attribute_method?(name) if (is_dangerous = _brick_dangerous_attribute_method?(name)) && is_view? if column_names.include?(name.to_s) puts "WARNING: Column \"#{name}\" in view #{table_name} conflicts with a reserved ActiveRecord method name." end return false end is_dangerous end |