Module: CanTango::Model::Actions
- Defined in:
- lib/cantango/model/actions.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
- .included(base) ⇒ Object
- .model_actions ⇒ Object
- .register(clazz) ⇒ Object
- .register_collection_actions(clazz, *actions) ⇒ Object
- .register_member_actions(clazz, *actions) ⇒ Object
Class Method Details
.included(base) ⇒ Object
3 4 5 6 |
# File 'lib/cantango/model/actions.rb', line 3 def self.included(base) register base base.extend ClassMethods end |
.model_actions ⇒ Object
24 25 26 |
# File 'lib/cantango/model/actions.rb', line 24 def self.model_actions CanTango.config.models.actions end |
.register(clazz) ⇒ Object
8 9 10 |
# File 'lib/cantango/model/actions.rb', line 8 def self.register clazz model_actions[clazz.to_s.underscore.to_sym] = CanTango::Configuration::Models::Actions.new end |
.register_collection_actions(clazz, *actions) ⇒ Object
18 19 20 21 22 |
# File 'lib/cantango/model/actions.rb', line 18 def self.register_collection_actions clazz, *actions actions.flatten.each do |action| model_actions[clazz].add_collection action.to_sym end end |
.register_member_actions(clazz, *actions) ⇒ Object
12 13 14 15 16 |
# File 'lib/cantango/model/actions.rb', line 12 def self.register_member_actions clazz, *actions actions.flatten.each do |action| model_actions[clazz].add_member action.to_sym end end |