Module: ActiveScaffold::Actions::Show

Defined in:
lib/active_scaffold/actions/show.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/active_scaffold/actions/show.rb', line 5

def self.included(base)
  if base.active_scaffold_config.model.primary_key.nil?
    raise "#{base.active_scaffold_config.model.name} has no primary key, show won't work"
  end

  base.before_action :show_authorized_filter, only: :show
end

Instance Method Details

#showObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/active_scaffold/actions/show.rb', line 13

def show
  # rest destroy falls back to rest show in case of disabled javascript
  # just render action_confirmation message for destroy
  if params.delete :destroy_action
    @record = find_if_allowed(params[:id], :read) if params[:id]
    action_confirmation_respond_to_html(:destroy)
  else
    do_show
    respond_to_action(:show)
  end
end