Class: Admin::PageAttachmentsController

Inherits:
ResourceController
  • Object
show all
Defined in:
app/controllers/admin/page_attachments_controller.rb

Instance Method Summary collapse

Instance Method Details

#load_modelObject



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_attachment_params[:page_id].blank? ? Page.new : Page.find_by_id(page_attachment_params[:page_id])
  rescue ActiveRecord::RecordNotFound
    render nothing: true, layout: false
  end
  self.model = PageAttachment.new(asset: @asset, page: @page)
end

#newObject



4
5
6
# File 'app/controllers/admin/page_attachments_controller.rb', line 4

def new
  render partial: 'attachment', object: model
end