Displaying 8 results from an estimated 8 matches for "restrict_to".
2007 Aug 11
2
Rspec and acl_system2 plugin
Hello,
I''m trying to spec a Rails application using the couple
restful_authentication/acl_system2 plugins.
In my admin layout, I put the following code :
<% restrict_to "admin" do -%>
<ul id="admin-tabs">
<li> /users Users management </li>
</ul>
<% end -%>
Then in my spec file ''spec/views/layout/admin.rhtml_spec.rb'' :
describe "Layout Admin if admin user" do
include UserMockView...
2007 Oct 18
0
ACL System restrict_to
Does the restrict_to method only work in the views for some reason? I
have tried it in the controller and i get the "undefined local variable
or method `restrict_to'' for Admin::SurveysController:Class" Ive even
copied the code from the access_control.rb in the plugin to the
application_helper but it...
2007 Jul 06
3
stubbing helper methods for View specs
...is:
it "should show bla" do
render "/layouts/thetool"
response.should have_tag("p", "bla")
end
and the view (haml to make things more interesting)
- if logged_in?
%p bla
Now I also use Ezra acl_system2 plugin which defines a "restrict_to"
method that queries some roles. When I stub the methods above and run
specs, I get the following error:
ActionView::TemplateError in ''/users/show should display the
information of the user''
undefined local variable or method `current_user'' for
#<Spec::Ra...
2007 Mar 06
15
mocking missing methods
Hi folks.
So I''m using mocha on a ruby project, and I really like it. One thing
I''ve noticed is that it can be a bit "surprising" when I''m mocking
methods that don''t exist on an object, and I think there''s an easyish fix.
At the moment, you use sheep = mock() to create a mock sheep. What I''d
like to do is something like sheep =
2006 Mar 06
20
How painful is the 1.0 -> 1.1 upgrade going to be?
Does anyone have a sense for how painful the 1.0 -> 1.1 upgrade is
going to be for existing apps? I''m finishing up my first real RoR
application with Rails 1.0. I can live with it staying at that level,
but I really want to use the has_many :through attribute to clean up
some of my code.
I''m not particularly interested in edge Rails, mainly because the
documentation for
2006 Jul 14
1
role-based conditionals
in the Rails Recipes book there is a chapter on role-based
authentication. it basically set up priviliges based on what page the
user was able to access. i went through the chapter and felt like i got
a pretty good understanding of how to do it.
now i am needing something a little more advanced though. instead of a
per page (or action) i would like to have certain sections on a page
either
2007 Aug 23
0
how to manage group permissions?
...grant other members of
the group to kick and ban.
This is how I want to do it:
I''m usgin acl_system2 and the creator can grant kick and ban
permissions to group members by creating roles "kick_group_id" or
"ban_group_id" for those users and then in the view I do:
<% restrict_to "(creator | kick_#{@group.id}) do %>
<%= link_to "kick this user out of the group",
group_membership(@group,membership),:method=>''delete''%>
<% end %>
is this a good way to deal with this problem or is there a (way)
better or simpler solution?
Th...
2006 Jul 16
9
acl_system help is needed
i found Ezra''s acl_system plugin yesterday and i am trying to figure it
out.
based on the simple instructions on the site, it does exactly what i
need but i''m getting some errors when i try to use it:
NoMethodError in UsersController#index
You have a nil object when you didn''t expect it!
The error occured while evaluating nil.roles
i am pretty new to rails and