mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-01-26 02:07:58 -05:00
All are fine except for plantings. I'm pretty sure hte problem is to do
with these two lines in app/model/ability.rb
can :update, Planting, :garden => { :owner_id => member.id }
can :destroy, Planting, :garden => { :owner_id => member.id }
I'm pretty sure that's the right syntax (according to
https://github.com/ryanb/cancan/wiki/Defining-Abilities) but since it's
the update and delete actions that are failing, I guess I must have it
wrong somehow. Any hints?
15 lines
392 B
Ruby
15 lines
392 B
Ruby
class ApplicationController < ActionController::Base
|
|
protect_from_forgery
|
|
|
|
# tweak CanCan defaults because we don't have a "current_user" method
|
|
def current_ability
|
|
@current_ability ||= Ability.new(current_member)
|
|
end
|
|
|
|
# CanCan error handling
|
|
rescue_from CanCan::AccessDenied do |exception|
|
|
redirect_to request.referer || root_url, :alert => exception.message
|
|
end
|
|
|
|
end
|