CanCan is leaving numbers in my views

I have a rail app setup with devise and i am now adding cancan.

The problem i am having is that where ever i have can? in my views, it adds a number. It only does this if the user does have the permission for the action. Everything else is working perfectly, it’s just these annoying numbers!

The club model and controller are just default as the scaffold generated, except i have a habtm with roles.

@clubs.each do |club|

%tr

%td= club.name

%td= link_to ‘Show’, club

= if can? :update, club

%td= link_to ‘Edit’, edit_club_path(club)

= if can? :destroy, club

%td= link_to ‘Destroy’, club, :confirm => ‘Are you sure?’, :method => :delete

Would generate the following if the user is an admin

football Show Edit

2

Destroy

2

But would generate the following if they are a guest

football Show

Why is cancan leaving 2’s in my views?

Has anyone else had this problem?

Where would i even begin to troubleshoot this?

ruby 1.9.3

rails 3.2.2

cancan 1.6.7

devise 2.0.4

Thank you,

scott

= if can? :update, club
  %td= link\_to 'Edit', edit\_club\_path\(club\)

You should be using

- if can? :update, club

Using = tells haml that you want the result of the if expression (ie
the value that "can? :update, club") to be output in the view.

Fred

Hi

Yo should write as this:

@clubs.each do |club|
   %tr
     %td= club.name
     %td= link_to 'Show', club
     - if can? :update, club
       %td= link_to 'Edit', edit_club_path(club)
     - if can? :destroy, club
       %td= link_to 'Destroy', club, :confirm => 'Are you
sure?', :method => :delete

using '-' instead of '=' in sentences with no html output

byeeee

that fixed it. i love when my mistakes are so easy to fix.

thank you,

scott