Module: Cathode::Action::RequiresHasOneAssociation
- Includes:
- RequiresAssociation
- Defined in:
- lib/cathode/action.rb
Overview
Raises an error if the action was defined on a resource whose parent doesn’t have a ‘has_one` association to the resource
Instance Method Summary collapse
-
#association_keys ⇒ Object
Defines the possible associations as ‘:resource` (`has_one`).
-
#error_message ⇒ Object
Provides an error message to display if the association is missing.
Methods included from RequiresAssociation
Instance Method Details
#association_keys ⇒ Object
Defines the possible associations as ‘:resource` (`has_one`)
157 158 159 |
# File 'lib/cathode/action.rb', line 157 def association_keys [resource.name.to_s.singularize.to_sym] end |
#error_message ⇒ Object
Provides an error message to display if the association is missing.
162 163 164 |
# File 'lib/cathode/action.rb', line 162 def "Can't use default :#{name} action on `#{parent.name}' without a has_one `#{resource.name.to_s.singularize}' association" end |