Class: Admin::PageAttachmentsController

Inherits:
ResourceController show all
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

#create_responses, extended

Methods inherited from ApplicationController

#after_sign_in_path_for, #initialize, #template_name

Methods included from LoginSystem

included

Constructor Details

This class inherits a constructor from ApplicationController

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