similar to: Cancan Rspec load_and_authorize_resource

Displaying 20 results from an estimated 300 matches similar to: "Cancan Rspec load_and_authorize_resource"

2012 Mar 30
1
cancan breaks scoped mass assignment
Hi all, I just installed cancan on a new project and found out that it creates some problems with the new scoped mass assignment features of rails 3.2 . Basically, in my User model I create some attr_accessible attributes in order to avoid users to edit their roles or other sensitive information. From the administration I allow admins to edit those protected attributes by passing
2010 Jun 21
4
Unknown action No action responded to 2. Actions: show
I''m trying to create a simple RoR application that shows me the records inside my table, provided that it is an example I''m working on the "Head First Rails" book. When I try to retrieve the record I get the following message: "Unknown action No action responded to 2. Actions: show" Why am I having that? And, how can I fix this issue? Provided that: 1- I
2011 Jun 05
1
Cancan redirect back at AccessDenied
Hello I have a rails 3 app and I am trying to implement the redirect back action at access denied for cancan. If I try this in my application_controller: rescue_from CanCan::AccessDenied do |exception| redirect_to :back end It gives the following error: No HTTP_REFERER was set in the request to this action, so redirect_to :back could not be called successfully. If this is a test, make sure
2012 Mar 06
0
Devise/Cancan Signout User On Controller Action
I have implemented Devise for Authentication and Authorization in ROR application everything seems fine but getting one issue. I have two modals "Account" and "Transactiona" , and so two controllers respectively. My Transaction Index view call one of Account Controller method like this
2010 Dec 02
8
CanCan issue when being very specific
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
2011 Mar 02
1
Setting CanCan ability.rs model
I successfully made login system with Devise and CanCan, and I have 3 types of users. Admin, internal and global users. I created Controllers and index actions: Admin, Cpanel, Report and State, and I want to restrict access to this controllers for some users. Admin user should have privilegies to access: Reports(all), State (read), Admin (all) Global user should have privilegies to access:
2012 Oct 09
8
unexpected should_receive behaviour
Hi, surely I''m missing something... but what!? in my spec I''ve User.should_receive(:find).with("1").and_return(@user) and in my controller User.find(params[:id]) green light... correct... but if I change my controller using another method, for example first: User.first or even User.all I get green light too... I was expecting an error like expected: 1 time
2010 Feb 14
2
paperclip is making me crazy
seems pretty simple, my model... has_attached_file :pic_1, :styles => { :thumb => "120x90" }, :url => "/:attachment/:id_:style.:extension", :path => ":rails_root/public/system/:attachment/:id_:style.:extension" my view... <% form_tag(:action => ''create'', :html => { :multipart => true }) do -%> <label
2012 Apr 05
5
rspec: identical tests fails when repeated
I''m doing RSpec controller testing with CanCan authorization, and I''m seeing something I''ve never seen in RSpec before: the same test run twice fails on the second one. I am NOT doing before(:all) or other things that should cause state to persist between tests: Here''s the relevant code: context "POST create" do context "with user logged
2010 Nov 24
1
NameError in Devise/sessionsController#new
I created a sample application. Added devise in it, it works fine. Then added cancan gem into it. Created an ability class. define some permissions. Then added line load_and_authorize_resource to the Application Controller, after that when i go to the page http://0.0.0.0:3000/users/sign_in it gave the following error, NameError in Devise/sessionsController#new uninitialized constant Session
2009 Mar 26
3
Using same variable in controller
Hi guys! More question :P~ OK, I''m following a tutorial for rail, and I got this new.html.erb in views, and in order for a form to be showed up correctly without error, I had to add this small snippet of code in the controller under method "def new". class AdsController < ApplicationController 2 def show 3 @ad = Ad.find(params[:id]) 4 end 5 6 def index
2014 Mar 25
0
Looking for some glue between Strong Parameters and CanCan
Hello Rails World, does anybody know a good solution for Strong Parameters in a Rails app authorized by Cancan (or a similar authorization gem)? def user_params if current_user.admin? params.require(:user).permit! else params.require(:user).permit(:password, :password_confirmation) end end Now I want to do this the "Cancan way". My first idea looks strange to me: def
2014 Mar 25
0
cancan gem being replaced
I just came across this so I thought I would post it on this board since I see cancan come up a lot. It seems that Ryan Bates (who is primarily responsible for cancan) is taking a hiatus and the gem is no longer being actively maintained. The collaborators on that gem have formed a new team and have released the gem cancancan which is now cancan updated for Rails 4. You read more about it
2011 Jul 28
0
CanCan filtering meta_search results?
At the moment, I am running meta_search, and then filtering through CanCan after I have a set of results. Is there any other way to restrict the returned objects within the initial search query? def index @search = User .search :first_name_or_last_name_or_practice_name_or_role_contains_any => params[:search].to_s.split('' '') @users =
2012 Oct 02
0
cancan and authorization on controller actions of a gem.
Hello. I''ve installed cancan and bigbluebutton_rails, https://github.com/mconf/bigbluebutton_rails. The gem bigbluebutton_rails has some models and controllers, for example has bigbluebutton/servers_controller.rb. This controller has some actions like create, join, authorize, etc. I want that only users with role admin can create. What can I do? I need to put load_resource in
2011 Aug 28
3
rspec-rails render_views doesn't render layouts? / how to check flash isn't rendered
I''m trying to test that "static" pages (they''re ERB, but get cached), generated through rails, don''t render any stray flash notices left over by the authentication system (Devise) or wherever else. I''ve tried writing this controller spec, but it appears that response.body only renders the template, not its layouts? describe "so that static
2011 Nov 28
4
getting a subdomain name in model.
Hi all, I am facing problem in getting subdomain name inside the model. The following is my setup. I am using cancan for authorization.I wanted a specific condition in Ability.rb ( the file which is placed in models if we install cancan gem). Below is the condition I wanted: ========================================================= user ||= User.new # guest user (not logged in) if
2012 Oct 15
0
CanCan load_resource get a nil resource
Hi, I''ve opened a question on StackOverflow regarding #load_resources and a create action in UserController: http://stackoverflow.com/questions/12882284/load-resource-get-a-nil-resource Could anyone please give me some hints? thank you! enrico -- · Enrico Stano · · twitter @enricostano · skype ocirneonats -- You received this message because you are subscribed to the Google
2013 Feb 20
3
Complex abilities and scoping of records
I have the following scenario. Users have various levels of ability. They can only view and edit their own records (their profile). Their managers can only view and edit their employees records. The regional managers can view and edit only the people in their regions and the corporate headquarters can view and edit all records. There are multiple regions so somebody can be the manager of the
2010 Jun 02
5
user routing versus admin routing strategies?
In an app where ordinary users are limited to viewing and editing their own "stuff", but someone with admin privs can view and edit anybody''s stuff, what''s the right strategy for routing? At first blush, I''d think that an ordinary user (e.g. with id 565) should see something like: http://example.com/mystuff.html ... where the controller assumes