Sha256: 68e5cf6e8bd939ca8912c4d0e05dbd820334429e5a2402830f35772fe366b4cf
Contents?: true
Size: 859 Bytes
Versions: 3
Compression:
Stored size: 859 Bytes
Contents
class <%= class_name %>Table < TableCloth::Base # Define columns with the #column method # column :name, :email # Columns can be provided a block # # column :name do |object| # object.downcase # end # # Columns can also have conditionals if you want. # The conditions are checked against the table's methods. # As a convience, the table has a #view method which will return the current view context. # This gives you access to current user, params, etc... # # column :email, if: :admin? # # def admin? # view.current_user.admin? # end # # Actions give you the ability to create a column for any actions you'd like to provide. # Pass a block with an arity of 2, (object, view context). # You can add as many actions as you want. # # action {|object, view| view.link_to "Edit", edit_object_path(object) } end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
table_cloth-0.1.2 | lib/generators/templates/table.rb |
table_cloth-0.1.1 | lib/generators/templates/table.rb |
table_cloth-0.1.0 | lib/generators/templates/table.rb |