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

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -