Sha256: 1b2c875e438653dd5f7b3ace1257e589307a865fcb5f44d13f9f5f97d109aa82
Contents?: true
Size: 1.34 KB
Versions: 5
Compression:
Stored size: 1.34 KB
Contents
class <%= class_name %> < Application provides :xml, :fxml # GET /<%= resource_path %> def index @<%= plural_model %> = <%= model_class_name %>.find(:all) display @<%= plural_model %> end # GET /<%= resource_path %>/:id def show @<%= singular_model %> = <%= model_class_name %>.find_by_id(params[:id]) raise NotFound unless @<%= singular_model %> display @<%= singular_model %> end # POST /<%= resource_path %> def create @<%= singular_model %> = <%= model_class_name %>.new(params[:<%= singular_model %>]) if @<%= singular_model %>.save display @<%= singular_model %> else display @<%= singular_model %>.errors end end # PUT /<%= resource_path %>/:id def update @<%= singular_model %> = <%= model_class_name %>.find_by_id(params[:id]) raise NotFound unless @<%= singular_model %> if @<%= singular_model %>.update_attributes(params[:<%= singular_model %>]) display @<%= singular_model %> else display @<%= singular_model %>.errors end end # DELETE /<%= resource_path %>/:id def destroy @<%= singular_model %> = <%= model_class_name %>.find_by_id(params[:id]) raise NotFound unless @<%= singular_model %> if @<%= singular_model %>.destroy display @<%= singular_model %> else display @<%= singular_model %>.errors end end end
Version data entries
5 entries across 5 versions & 2 rubygems