What message are you getting?

On Thu, Dec 2, 2010 at 9:28 AM, Leonel *.* <li...@ruby-forum.com> wrote:

> So I got CanCan and Devise working well. I have two types of users:
> Admins and Nonadmins. Admins can edit all of Nonadmins profiles.
>
> The problem is, every user (either Admin or Nonadmin) belongs to an
> Account or Organization. Admins should only be able to edit users from
> their own Account or Organization. I was able to do that too.
>
> The problem is, I can't display the Create New User link. It seems
> everything is correct but I must be doing something wrong.
>
> HERE IS ABILITY.RB
> ---------------------------------------------
>    if user.role == "admin"
>      can :read, User do |u|
>        u.try(:account_id) == user.account_id
>      end
>      can :update, User do |u|
>        u.try(:account_id) == user.account_id
>      end
>      can :destroy, User do |u|
>        u.try(:account_id) == user.account_id
>      end
>
>      can :create, User
> ---------------------------------------------
>
> HERE IS APP/VIEWS/USERS/INDEX.HTML.ERB
> ---------------------------------------------
> <% if can? :create, @user %>
>  <div style="clear:both;padding-top:20px;"><%= link_to 'New User',
> new_user_path %></div>
> <% end %>
> ---------------------------------------------
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-t...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com<rubyonrails-talk%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
_________________________________

Joshua S. Martin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to