Sha256: a4192f88f7bd6456f483164bb7423e69fe95a4a35a6b2cfb2775644cf4a52d77
Contents?: true
Size: 1020 Bytes
Versions: 3
Compression:
Stored size: 1020 Bytes
Contents
class <%= plural_class_name %>Controller < ApplicationController::Base respond_to :html, :xml, :json <% for action in actions -%> <% unless options[:singleton] && action == 'index '-%> def <%= action %> <% case action when 'create' then -%> respond_with(@<%= singular_name %> = <%= class_name %>.create(params[:<%= singular_name %>])) <% when 'index' then -%> respond_with(@<%= plural_name %> = <%= class_name %>.all) <% when 'new' then -%> respond_with(@<%= singular_name %> = <%= class_name %>.new) <% when 'update' then -%> @<%= singular_name %> = <%= class_name %>.find(params[:id]) @<%= singular_name %>.update_attributes(params[:<%= singular_name %>]) respond_with(@<%= singular_name %>) <% else -%> respond_with(@<%= singular_name %> = <%= class_name %>.find(params[:id])) <% end -%> end <% end -%> <% end -%> end
Version data entries
3 entries across 3 versions & 1 rubygems