I want to get a list of say moderators from User model, it works in this case
u = User.new(:name => "n", :surname => "s", :email => "a@m.c", :password => "x")
u.add_role(:moderator)
u.save!
but if i assign a resource to User model like this, it's not listing users with role moderator
u = User.new(:name => "m", :surname => "b", :email => "a@m.c", :password => "x")
u.add_role(:moderator, Post.first)
u.save!
UPDATE
post.rb
class Post < ActiveRecord::Base
attr_accessible :user_id, :content
belongs_to :user
end
user.rb
class User < ActiveRecord::Base
rolify
end