Class: AdminAssistant::Request::Show

Inherits:
Base
  • Object
show all
Defined in:
lib/admin_assistant/request/show.rb

Instance Method Summary collapse

Methods inherited from Base

#action, #after_template_file, #before_template_file, #initialize, #model_class, #model_class_symbol, #origin, #render_multi_form, #render_single_form, #render_template_file, #render_to_string, #render_to_string_if_exists

Constructor Details

This class inherits a constructor from AdminAssistant::Request::Base

Instance Method Details

#callObject



4
5
6
7
8
9
10
11
12
# File 'lib/admin_assistant/request/show.rb', line 4

def call
  @record = model_class.find @controller.params[:id]
  @controller.instance_variable_set :@record, @record
  @controller.send(
    :render,
    :file => AdminAssistant.template_file('show'), :layout => true,
    :locals => {:request => self}
  )
end

#model_class_name(record) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/admin_assistant/request/show.rb', line 14

def model_class_name(record)
  if block = @admin_assistant.show_settings.model_class_name_block
    block.call record
  else
    @admin_assistant.model_class_name
  end
end