Class: Api::V2::TemplateInputsController
- Inherits:
-
BaseController
- Object
- BaseController
- Api::V2::TemplateInputsController
- Includes:
- Api::Version2, Foreman::Renderer
- Defined in:
- app/controllers/api/v2/template_inputs_controller.rb
Instance Method Summary collapse
- #action_permission ⇒ Object
- #controller_permission ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #resource_name(nested_resource = nil) ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#action_permission ⇒ Object
70 71 72 73 74 75 76 77 |
# File 'app/controllers/api/v2/template_inputs_controller.rb', line 70 def case params[:action] when :create, :edit, :destroy 'edit' else super end end |
#controller_permission ⇒ Object
66 67 68 |
# File 'app/controllers/api/v2/template_inputs_controller.rb', line 66 def 'templates' end |
#create ⇒ Object
42 43 44 45 |
# File 'app/controllers/api/v2/template_inputs_controller.rb', line 42 def create @template_input = resource_class.new(params[:template_input].merge(:template_id => @nested_obj.id)) process_response @template_input.save end |
#destroy ⇒ Object
50 51 52 |
# File 'app/controllers/api/v2/template_inputs_controller.rb', line 50 def destroy process_response @template_input.destroy end |
#index ⇒ Object
14 15 16 |
# File 'app/controllers/api/v2/template_inputs_controller.rb', line 14 def index @template_inputs = nested_obj.template_inputs.search_for(*).paginate() end |
#resource_name(nested_resource = nil) ⇒ Object
62 63 64 |
# File 'app/controllers/api/v2/template_inputs_controller.rb', line 62 def resource_name(nested_resource = nil) nested_resource || 'template_input' end |
#show ⇒ Object
21 22 |
# File 'app/controllers/api/v2/template_inputs_controller.rb', line 21 def show end |
#update ⇒ Object
58 59 60 |
# File 'app/controllers/api/v2/template_inputs_controller.rb', line 58 def update process_response @template_input.update_attributes(params[:template_input]) end |