Class: DisplayFor::Builder::CollectionBase
- Defined in:
- lib/display_for/builder/collection_base.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
Attributes inherited from Base
#html_options, #namespace, #resource_class, #template
Instance Method Summary collapse
- #default_actions ⇒ Object
-
#initialize(resource_class, collection, html_options, template, &block) ⇒ CollectionBase
constructor
A new instance of CollectionBase.
Methods inherited from Base
Constructor Details
#initialize(resource_class, collection, html_options, template, &block) ⇒ CollectionBase
Returns a new instance of CollectionBase.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/display_for/builder/collection_base.rb', line 6 def initialize(resource_class, collection, , template, &block) @collection = collection if resource_class.is_a?(Array) @namespace = resource_class @resource_class = @namespace.pop else @namespace = [] @resource_class = resource_class end super(, template, &block) end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
4 5 6 |
# File 'lib/display_for/builder/collection_base.rb', line 4 def collection @collection end |
Instance Method Details
#default_actions ⇒ Object
20 21 22 23 24 |
# File 'lib/display_for/builder/collection_base.rb', line 20 def default_actions action :show action :edit, :link_to => lambda { |r| [:edit] + @namespace + [r] } action :delete, :method => :delete, :confirm => "Are you sure?" end |