Module: ToyResources::Methods::ClassMethods
- Defined in:
- lib/toy-resources/methods.rb
Instance Method Summary collapse
Instance Method Details
#model ⇒ Object
32 33 34 |
# File 'lib/toy-resources/methods.rb', line 32 def model to_s.gsub('Controller', '').underscore.singularize.camelize.constantize end |
#resources(*args) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/toy-resources/methods.rb', line 21 def resources *args = args. actions = {} include(singular? ? ToyResources::Singular : ToyResources::Plural) nested_to([:nested_to]) actions[:crud] = crud_actions if args.first == :all actions[:crud] = crud_actions - .delete(:except) if [:except] actions[:crud] = .delete(:only) if [:only] define_actions self, actions, end |