Module: Cathode::Action::RequiresHasManyAssociation
- 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_many` association to the resource
Instance Method Summary collapse
-
#association_keys ⇒ Object
Defines the possible associations as ‘:resources` (`has_many`).
-
#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 ‘:resources` (`has_many`).
173 174 175 |
# File 'lib/cathode/action.rb', line 173 def association_keys [resource.name.to_s.pluralize.to_sym] end |
#error_message ⇒ Object
Provides an error message to display if the association is missing.
178 179 180 |
# File 'lib/cathode/action.rb', line 178 def "Can't use default :#{name} action on `#{parent.name}' without a has_many or has_and_belongs_to_many `#{resource.name.to_s.singularize}' association" end |