Class: RailsAdmin::Adapters::ActiveRecord::Property
- Inherits:
-
Object
- Object
- RailsAdmin::Adapters::ActiveRecord::Property
- Defined in:
- lib/rails_admin/adapters/active_record.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#property ⇒ Object
readonly
Returns the value of attribute property.
Instance Method Summary collapse
- #association? ⇒ Boolean
-
#initialize(property, model) ⇒ Property
constructor
A new instance of Property.
- #length ⇒ Object
- #name ⇒ Object
- #nullable? ⇒ Boolean
- #pretty_name ⇒ Object
- #read_only? ⇒ Boolean
- #serial? ⇒ Boolean
- #type ⇒ Object
Constructor Details
#initialize(property, model) ⇒ Property
Returns a new instance of Property.
143 144 145 146 |
# File 'lib/rails_admin/adapters/active_record.rb', line 143 def initialize(property, model) @property = property @model = model end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
141 142 143 |
# File 'lib/rails_admin/adapters/active_record.rb', line 141 def model @model end |
#property ⇒ Object (readonly)
Returns the value of attribute property.
141 142 143 |
# File 'lib/rails_admin/adapters/active_record.rb', line 141 def property @property end |
Instance Method Details
#association? ⇒ Boolean
176 177 178 |
# File 'lib/rails_admin/adapters/active_record.rb', line 176 def association? false end |
#length ⇒ Object
164 165 166 |
# File 'lib/rails_admin/adapters/active_record.rb', line 164 def length property.limit end |
#name ⇒ Object
148 149 150 |
# File 'lib/rails_admin/adapters/active_record.rb', line 148 def name property.name.to_sym end |
#nullable? ⇒ Boolean
168 169 170 |
# File 'lib/rails_admin/adapters/active_record.rb', line 168 def nullable? property.null end |
#pretty_name ⇒ Object
152 153 154 |
# File 'lib/rails_admin/adapters/active_record.rb', line 152 def pretty_name property.name.to_s.tr('_', ' ').capitalize end |
#read_only? ⇒ Boolean
180 181 182 |
# File 'lib/rails_admin/adapters/active_record.rb', line 180 def read_only? false end |
#serial? ⇒ Boolean
172 173 174 |
# File 'lib/rails_admin/adapters/active_record.rb', line 172 def serial? property.primary end |
#type ⇒ Object
156 157 158 159 160 161 162 |
# File 'lib/rails_admin/adapters/active_record.rb', line 156 def type if model.serialized_attributes[property.name.to_s] :serialized else property.type end end |