Class: Offroad::ModelState
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Offroad::ModelState
- Defined in:
- lib/app/models/offroad/model_state.rb
Constant Summary
Constants included from ModelExtensions
Offroad::ModelExtensions::OFFROAD_GROUP_MODES, Offroad::ModelExtensions::OFFROAD_VALID_MODES
Instance Method Summary collapse
Methods included from ModelExtensions
#acts_as_offroadable, #acts_as_offroadable?, #offroad_global_data?, #offroad_group_base?, #offroad_group_data?, #offroad_model_state, #safe_to_load_from_cargo_stream?
Instance Method Details
#app_model ⇒ Object
26 27 28 |
# File 'lib/app/models/offroad/model_state.rb', line 26 def app_model app_model_name.constantize end |
#validate ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/app/models/offroad/model_state.rb', line 9 def validate model = nil begin model = app_model rescue NameError errors.add_to_base "Given model name does not correspond to a constant" end if model errors.add_to_base "Constant is not a mirrored model" unless self.class.valid_model?(model) end end |