module ActiveScaffold::Actions::Show
Public Class Methods
included(base)
click to toggle source
# File lib/active_scaffold/actions/show.rb, line 3 def self.included(base) base.before_filter :show_authorized_filter, :only => :show base.helper_method :show_columns end
Public Instance Methods
show()
click to toggle source
# File lib/active_scaffold/actions/show.rb, line 8 def show # rest destroy falls back to rest show in case of disabled javascript # just render action_confirmation message for destroy unless params.delete :destroy_action do_show successful? respond_to_action(:show) else @record = find_if_allowed(params[:id], :read) if params[:id] && params[:id] && params[:id].to_i > 0 action_confirmation_respond_to_html(:destroy) end end
Protected Instance Methods
do_show()
click to toggle source
A simple method to retrieve and prepare a record for showing. May be overridden to customize show routine
# File lib/active_scaffold/actions/show.rb, line 47 def do_show @record = find_if_allowed(params[:id], :read) end
show_columns()
click to toggle source
# File lib/active_scaffold/actions/show.rb, line 61 def show_columns active_scaffold_config.show.columns end
show_columns_names()
click to toggle source
# File lib/active_scaffold/actions/show.rb, line 65 def show_columns_names show_columns.collect(&:name) end
show_formats()
click to toggle source
# File lib/active_scaffold/actions/show.rb, line 57 def show_formats (default_formats + active_scaffold_config.formats + active_scaffold_config.show.formats).uniq end
show_respond_to_html()
click to toggle source
# File lib/active_scaffold/actions/show.rb, line 42 def show_respond_to_html render :action => 'show' end
show_respond_to_js()
click to toggle source
# File lib/active_scaffold/actions/show.rb, line 38 def show_respond_to_js render :partial => 'show' end
show_respond_to_json()
click to toggle source
# File lib/active_scaffold/actions/show.rb, line 23 def show_respond_to_json column_names = successful? ? show_columns_names : error_object_attributes render :text => response_object.to_json(:only => show_columns_names, :methods => virtual_columns(column_names)), :content_type => Mime::JSON, :status => response_status end
show_respond_to_xml()
click to toggle source
# File lib/active_scaffold/actions/show.rb, line 33 def show_respond_to_xml column_names = successful? ? show_columns_names : error_object_attributes render :xml => response_object.to_xml(:only => show_columns_names, :methods => virtual_columns(column_names)), :content_type => Mime::XML, :status => response_status end
show_respond_to_yaml()
click to toggle source
# File lib/active_scaffold/actions/show.rb, line 28 def show_respond_to_yaml column_names = successful? ? show_columns_names : error_object_attributes render :text => Hash.from_xml(response_object.to_xml(:only => show_columns_names, :methods => virtual_columns(column_names))).to_yaml, :content_type => Mime::YAML, :status => response_status end