ruby on rails 3 - Getting current_user error when using Ryan Bates' CanCan authorization plugin -


the portion of view applicable:

<% @projects.each |project| %>     <tr>         <td><%= project.name %></td>         <td><%= project.description %></td>         <td><%= link_to 'show', project %></td>         <% if can? :update, @project  %>         <td><%= link_to 'edit', edit_project_path(project) %></td>         <% end %>         <% if can? :destroy, @project %>         <td><%= link_to 'destroy', project, :confirm => 'are sure?', :method => :delete %></td>         <% end %>     </tr> <% end %> 

models/ability.rb

class ability   include cancan::ability    def initialize(designer)       can :read, :all   end  end 

this error get:

nameerror in projects#index undefined local variable or method `current_user' #<projectscontroller:0x000001016d62d8> extracted source (around line #18):  15:         <td><%= project.description %></td> 16:         <td><%= link_to 'show', project %></td> 17:          18:         <% if can? :update, @project %> 19:             <td><%= link_to 'edit', edit_project_path(project) %></td> 20:         <% end %> 21:          

thoughts?

i had errors in authlogic install. or rather, not errors, when installed used current_designer (which main user concentrating on) rather current_user.

it seems cancan didn't that.

so in process of re-doing user models. far, seems have fixed issue.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -