Sha256: dd4793759c6e4e8c8dc5be3756a7db1f025ff55884022e1a3ebc7ff5998c7e24

Contents?: true

Size: 1.51 KB

Versions: 97

Compression:

Stored size: 1.51 KB

Contents

module ActiveScaffold::Actions
  module Show
    def self.included(base)
      base.before_filter :show_authorized_filter, :only => :show
    end

    def show
      do_show
      successful?
      respond_to_action(:show)
    end

    protected
    
    def show_respond_to_json
      render :text => response_object.to_json, :content_type => Mime::JSON, :status => response_status
    end

    def show_respond_to_yaml
      render :text => response_object.to_yaml, :content_type => Mime::YAML, :status => response_status
    end

    def show_respond_to_xml
      render :xml => response_object.to_xml, :content_type => Mime::XML, :status => response_status
    end

    def show_respond_to_js
      render :partial => 'show'
    end

    def show_respond_to_html
      render :action => 'show'
    end
    # A simple method to retrieve and prepare a record for showing.
    # May be overridden to customize show routine
    def do_show
      @record = find_if_allowed(params[:id], :read)
    end

    # The default security delegates to ActiveRecordPermissions.
    # You may override the method to customize.
    def show_authorized?
      authorized_for?(:action => :read)
    end
    private 
    def show_authorized_filter
      link = active_scaffold_config.show.link || active_scaffold_config.show.class.link
      raise ActiveScaffold::ActionNotAllowed unless self.send(link.security_method)
    end
    def show_formats
      (default_formats + active_scaffold_config.formats + active_scaffold_config.show.formats).uniq
    end
  end
end

Version data entries

97 entries across 97 versions & 2 rubygems

Version Path
six-updater-web-0.17.3 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.17.2 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.17.1 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.17.0 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.16.3 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.16.2 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.16.0 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.15.4 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.15.3 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.15.2 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.15.1 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.14.12 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.14.10 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.14.9 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.14.8 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.14.7 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.14.6 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.14.5 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.14.4 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb
six-updater-web-0.14.3 lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/show.rb