Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/citier/core_ext.rb
Class Method Summary collapse
- .[](column_name) ⇒ Object
- .acts_as_citier? ⇒ Boolean
-
.create_class_writable(class_reference) ⇒ Object
creation of a new class which inherits from ActiveRecord::Base.
- .set_acts_as_citier(citier) ⇒ Object
Instance Method Summary collapse
Class Method Details
.[](column_name) ⇒ Object
11 12 13 |
# File 'lib/citier/core_ext.rb', line 11 def self.[](column_name) arel_table[column_name] end |
.acts_as_citier? ⇒ Boolean
7 8 9 |
# File 'lib/citier/core_ext.rb', line 7 def self.acts_as_citier? @acts_as_citier || false end |
.create_class_writable(class_reference) ⇒ Object
creation of a new class which inherits from ActiveRecord::Base
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/citier/core_ext.rb', line 19 def self.create_class_writable(class_reference) #creation of a new class which inherits from ActiveRecord::Base Class.new(ActiveRecord::Base) do include Citier::InstanceMethods::ForcedWriters t_name = class_reference.table_name t_name = t_name[5..t_name.length] if t_name[0..5] == "view_" t_name = t_name[5..t_name.length] end # set the name of the table associated to this class # this class will be associated to the writable table of the class_reference class self.table_name = t_name end end |
.set_acts_as_citier(citier) ⇒ Object
3 4 5 |
# File 'lib/citier/core_ext.rb', line 3 def self.set_acts_as_citier(citier) @acts_as_citier = citier end |
Instance Method Details
#is_new_record(state) ⇒ Object
15 16 17 |
# File 'lib/citier/core_ext.rb', line 15 def is_new_record(state) @new_record = state end |