Module: Effective::CrudController::ClassMethods
- Includes:
- Dsl
- Defined in:
- app/controllers/concerns/effective/crud_controller.rb
Instance Method Summary collapse
-
#define_actions_from_routes ⇒ Object
Automatically respond to any action defined via the routes file.
- #define_permitted_params_from_model ⇒ Object
- #effective_resource ⇒ Object
Methods included from Dsl
#after_commit, #after_error, #after_save, #before_render, #before_save, #button, #on, #page_title, #resource_scope, #submit
Instance Method Details
#define_actions_from_routes ⇒ Object
Automatically respond to any action defined via the routes file
26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/concerns/effective/crud_controller.rb', line 26 def define_actions_from_routes (effective_resource.member_actions - effective_resource.crud_actions).each do |action| define_method(action) { member_action(action) } end (effective_resource.collection_actions - effective_resource.crud_actions).each do |action| define_method(action) { collection_action(action) } end end |
#define_permitted_params_from_model ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/concerns/effective/crud_controller.rb', line 36 def define_permitted_params_from_model if effective_resource.model.present? define_method(:effective_resource_permitted_params) { resource_permitted_params } # save.rb end if effective_resource.active_model? define_method(:effective_resource_permitted_params) { resource_active_model_permitted_params } # save.rb end end |