Class: Admin::PageAttachmentsController
- Inherits:
-
ResourceController
- Object
- ActionController::Base
- ApplicationController
- ResourceController
- Admin::PageAttachmentsController
- Defined in:
- app/controllers/admin/page_attachments_controller.rb
Instance Attribute Summary
Attributes inherited from ApplicationController
#cache, #pagination_parameters, #trusty_config
Instance Method Summary collapse
Methods inherited from ResourceController
#destroy, #index, model_class, paginate_models, #paginated?, #pagination_parameters, #will_paginate_options
Methods included from TrustyCms::ResourceResponses
Methods inherited from ApplicationController
#after_sign_in_path_for, #initialize, #template_name
Methods included from LoginSystem
Constructor Details
This class inherits a constructor from ApplicationController
Instance Method Details
#load_model ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/admin/page_attachments_controller.rb', line 8 def load_model begin @asset = Asset.find(params[:asset_id]) @page = [:page_id].blank? ? Page.new : Page.find_by_id([:page_id]) rescue ActiveRecord::RecordNotFound render nothing: true, layout: false end self.model = PageAttachment.new(asset: @asset, page: @page) end |
#new ⇒ Object
4 5 6 |
# File 'app/controllers/admin/page_attachments_controller.rb', line 4 def new render partial: 'attachment', object: model end |