module Wallaby::ResourcesConcern

Resources concern

Public Instance Methods

create(options = {}, &block) click to toggle source
# File lib/concerns/wallaby/resources_concern.rb, line 388
def create(options = {}, &block)
  set_defaults_for :create, options
  current_authorizer.authorize :create, resource
  current_servicer.create resource, options.delete(:params)
  respond_with resource, options, &block
end
destroy(options = {}, &block) click to toggle source
# File lib/concerns/wallaby/resources_concern.rb, line 420
def destroy(options = {}, &block)
  set_defaults_for :destroy, options
  current_authorizer.authorize :destroy, resource
  current_servicer.destroy resource, options.delete(:params)
  respond_with resource, options, &block
end
edit(options = {}, &block) click to toggle source
# File lib/concerns/wallaby/resources_concern.rb, line 404
def edit(options = {}, &block)
  current_authorizer.authorize :edit, resource
  respond_with resource, options, &block
end
home() click to toggle source
# File lib/concerns/wallaby/resources_concern.rb, line 370
def home
  # do nothing
end
index(options = {}, &block) click to toggle source
# File lib/concerns/wallaby/resources_concern.rb, line 374
def index(options = {}, &block)
  current_authorizer.authorize :index, current_model_class
  respond_with collection, options, &block
end
new(options = {}, &block) click to toggle source
# File lib/concerns/wallaby/resources_concern.rb, line 381
def new(options = {}, &block)
  current_authorizer.authorize :new, resource
  respond_with resource, options, &block
end
resource_params() click to toggle source
# File lib/concerns/wallaby/resources_concern.rb, line 429
def resource_params
  @resource_params ||= current_servicer.permit params, action_name
end
show(options = {}, &block) click to toggle source
# File lib/concerns/wallaby/resources_concern.rb, line 397
def show(options = {}, &block)
  current_authorizer.authorize :show, resource
  respond_with resource, options, &block
end
update(options = {}, &block) click to toggle source
# File lib/concerns/wallaby/resources_concern.rb, line 411
def update(options = {}, &block)
  set_defaults_for :update, options
  current_authorizer.authorize :update, resource
  current_servicer.update resource, options.delete(:params)
  respond_with resource, options, &block
end