Sha256: 1f548558970adb8903af5afe80689c7a8e0b4651dd236baceb080d8377b4a78a
Contents?: true
Size: 829 Bytes
Versions: 2
Compression:
Stored size: 829 Bytes
Contents
require_dependency "red_base/api_controller" class API::V1::<%= resource.pluralize %>Controller < APIController load_and_authorize_resource :except => :destory # GET /api/v1/<%= resource.pluralize.underscore %> def index end def create if @<%= resource.underscore %>.save @<%= resource.underscore %> else @<%= resource.underscore %>.errors end end def show end def update if @<%= resource.underscore %>.update @<%= resource.underscore %> else @<%= resource.underscore %>.errors end end def destroy ids = params[:id].split(",") @<% resource.pluralize.underscore %> = <% resource.pluralize %>.where(:id => ids) authorize! :destory, @<% resource.pluralize.underscore %> @@<% resource.pluralize.underscore %>.destroy_all end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
red_base-0.5.1 | lib/generators/red_base/templates/api/controller.rb.erb~ |
red_base-0.5.0 | lib/generators/red_base/templates/api/controller.rb.erb~ |