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
530 |
# File 'lib/brick/extensions.rb', line 530 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.)
533 534 535 536 537 538 539 540 541 |
# File 'lib/brick/extensions.rb', line 533 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 |