Sha256: 0f2eb29b8fa5c7c9c14fddcd99e4f92402876ce9dde2f713951a6ad8337c798b
Contents?: true
Size: 921 Bytes
Versions: 2
Compression:
Stored size: 921 Bytes
Contents
class Manage::<%= controller_class_name %>Controller < Manage::BaseController inherit_resources defaults :route_prefix => 'manage' before_filter :make_filter, :only=>[:index] load_and_authorize_resource :class => <%= class_name %> def create create!{ manage_<%= plural_name %>_path } end def update update!{ manage_<%= plural_name %>_path } end def destroy destroy!{ manage_<%= plural_name %>_path } end protected def collection options = { :page => params[:page], :per_page => 20 } options.update @search.filter @<%= plural_name %> = (@<%= plural_name %> || end_of_association_chain).paginate(options) end def make_filter @search = Freeberry::ModelFilter.new(<%= class_name %>, :attributes=>[ <%= model.attributes.keys.map{ |a| ":#{a}" }.join(', ') %> ] ) @search.update_attributes(params[:search]) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
freeberry-0.3.0 | lib/generators/freeberry/manage_scaffold/templates/single/controller.rb |
freeberry-0.2.9 | lib/generators/freeberry/manage_scaffold/templates/single/controller.rb |