ruby - Rails CanCan - wrong number of arguments (0 for 2+) -
I have received this code:
def editing @ shipp = ship.fund ( params [: id]) authorized! if can? : Make, @ship # unauthorized! if can? : Update, @ship # unauthorized! If not? : Update, @ship End And I'm getting this error:
Error on logic / ships / 4 / Edit the wrong number of arguments (For 2 to 2) +) which is highlighting this line:
authorize! if can? : Make, @ship I have tried a lot, but whatever we did earlier, which was just now:
authorize! @ship And lack of rewriting of user system with roles I'm not sure how to solve it.
This is my ability class:
Class eligibility includes CanCan :: Ability def initializer (user) #if! User if user.try (: admin?) Can: manage, return: all Elsf! Users can: read, ship: can read, planets can be returned again: read, all: # scan: management, ship, user_id = & gt; User.id: can manage, ship. Ship Ship.try (: user) == User end end
method two required The parameter is at least - verb and subject , so your code should probably appear: authorize! : If you can ship, @, if? : Create, @ship
Comments
Post a Comment