Class: RailsAdmin::Adapters::ActiveRecord::Property
- Inherits:
-
Object
- Object
- RailsAdmin::Adapters::ActiveRecord::Property
- Defined in:
- lib/rails_admin/adapters/active_record/property.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.
7 8 9 10 |
# File 'lib/rails_admin/adapters/active_record/property.rb', line 7 def initialize(property, model) @property = property @model = model end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
5 6 7 |
# File 'lib/rails_admin/adapters/active_record/property.rb', line 5 def model @model end |
#property ⇒ Object (readonly)
Returns the value of attribute property.
5 6 7 |
# File 'lib/rails_admin/adapters/active_record/property.rb', line 5 def property @property end |
Instance Method Details
#association? ⇒ Boolean
40 41 42 |
# File 'lib/rails_admin/adapters/active_record/property.rb', line 40 def association? false end |
#length ⇒ Object
28 29 30 |
# File 'lib/rails_admin/adapters/active_record/property.rb', line 28 def length property.limit end |
#name ⇒ Object
12 13 14 |
# File 'lib/rails_admin/adapters/active_record/property.rb', line 12 def name property.name.to_sym end |
#nullable? ⇒ Boolean
32 33 34 |
# File 'lib/rails_admin/adapters/active_record/property.rb', line 32 def nullable? property.null end |
#pretty_name ⇒ Object
16 17 18 |
# File 'lib/rails_admin/adapters/active_record/property.rb', line 16 def pretty_name property.name.to_s.tr('_', ' ').capitalize end |
#read_only? ⇒ Boolean
44 45 46 |
# File 'lib/rails_admin/adapters/active_record/property.rb', line 44 def read_only? false end |
#serial? ⇒ Boolean
36 37 38 |
# File 'lib/rails_admin/adapters/active_record/property.rb', line 36 def serial? model.primary_key == property.name end |
#type ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/rails_admin/adapters/active_record/property.rb', line 20 def type if serialized? :serialized else property.type end end |