Module: ActionView::ModelNaming
- Included in:
- Helpers::FormBuilder, Helpers::FormHelper, RecordIdentifier, RecordIdentifier
- Defined in:
- actionview/lib/action_view/model_naming.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#convert_to_model(object) ⇒ Object
Converts the given object to an ActiveModel compliant one.
- #model_name_from_record_or_class(record_or_class) ⇒ Object
Instance Method Details
#convert_to_model(object) ⇒ Object
Converts the given object to an ActiveModel compliant one.
6 7 8 |
# File 'actionview/lib/action_view/model_naming.rb', line 6 def convert_to_model(object) object.respond_to?(:to_model) ? object.to_model : object end |
#model_name_from_record_or_class(record_or_class) ⇒ Object
10 11 12 |
# File 'actionview/lib/action_view/model_naming.rb', line 10 def model_name_from_record_or_class(record_or_class) convert_to_model(record_or_class).model_name end |