Module: Protector::Adapters::ActiveRecord::Base::ClassMethods
- Defined in:
- lib/protector/adapters/active_record/base.rb
Instance Method Summary collapse
-
#define_method_attribute(name) ⇒ Object
Wraps every
.field
method with a check against DSL::Meta::Box#readable?. -
#protector_meta ⇒ Object
Storage of DSL::Meta.
Instance Method Details
#define_method_attribute(name) ⇒ Object
Wraps every .field
method with a check against DSL::Meta::Box#readable?
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/protector/adapters/active_record/base.rb', line 67 def define_method_attribute(name) super # Show some <3 to composite primary keys unless primary_key == name || Array(primary_key).include?(name) generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1 alias_method #{"#{name}_unprotected".inspect}, #{name.inspect} def #{name} if !protector_subject? || protector_meta.readable?(#{name.inspect}) #{name}_unprotected else nil end end STR end end |
#protector_meta ⇒ Object
Storage of DSL::Meta
60 61 62 63 64 |
# File 'lib/protector/adapters/active_record/base.rb', line 60 def (Protector::Adapters::ActiveRecord) do column_names end end |