Sha256: 58540b0d968f52752094a19d09f79e03c8a7e1ad7731eec43dc3015d2769e551
Contents?: true
Size: 1.08 KB
Versions: 61
Compression:
Stored size: 1.08 KB
Contents
class <%= scope_class %>::<%= controller_class_name %>Controller < <%= scope_class %>::BaseController respond_to :html, :js def index @search = <%= resource_class_name %>.search(params[:search]) @<%= collection_name %> = @search.page(params[:page] || 1) end def new <%- if content? -%> @<%= resource_name %> = <%= resource_class_name %>.new(:author_id => current_user._id) <%- else -%> @<%= resource_name %> = <%= resource_class_name %>.new <%- end -%> end def edit end def create @<%= resource_name %> = <%= resource_class_name %>.new(params[:<%= resource_name %>]) if @<%= resource_name %>.respond_to?(:author) @<%= resource_name %>.author ||= current_user end @<%= resource_name %>.save respond_with(@<%= resource_name %>) end def update @<%= resource_name %>.attributes = params[:<%= resource_name %>] @<%= resource_name %>.save respond_with(@<%= resource_name %>) end def destroy @<%= resource_name %>.destroy respond_with(@<%= resource_name %>) end end
Version data entries
61 entries across 61 versions & 1 rubygems