Re: [Rails] Re: RBAC_CANCAN

2017-07-18 Thread babacar thiam
yeah in this i want to know how do to insert a new users using user view or devise and respected role. in my userscontroller if i put at the top: before_filter :authentificate_user i hav and error saying use before_action Le mardi 18 juillet 2017 22:47:12 UTC-4, David Gleba a écrit : > > The

Re: [Rails] Re: RBAC_CANCAN

2017-07-18 Thread David Gleba
The article has an app in github. https://github.com/jameshibbard/authentication-with-devise-and-cancancan Can you download it and run it successfully? On Tuesday, July 18, 2017 at 10:28:33 PM UTC-4, David Gleba wrote: > > I see that in one spot you have Admin - capitalized. and in another it

Re: [Rails] Re: RBAC_CANCAN

2017-07-18 Thread David Gleba
I see that in one spot you have Admin - capitalized. and in another it is not capitalized - admin. I wonder if capitalization matters in your code. Note that we can't see your code. That makes it harder to help you when we can't see the code. On Tuesday, July 18, 2017 at 7:07:11 PM UTC-4, ba

Re: [Rails] Re: RBAC_CANCAN

2017-07-18 Thread babacar thiam
the error says no MethodError (undefined method `name' for nil:NilClass): app/models/user.rb:15:in `admin?' app/models/ability.rb:7:in `initialize' Le mardi 18 juillet 2017 17:15:51 UTC-4, Colin Law a écrit : > > On 18 July 2017 at 22:02, babacar thiam > > wrote: > > > > hi i have a mist

Re: [Rails] Re: RBAC_CANCAN

2017-07-18 Thread Colin Law
On 18 July 2017 at 22:02, babacar thiam wrote: > > hi i have a mistake since this morning . > > undefined method `name' for nil:NilClass > > Extracted source (around line #15): > > end > def admin? > self.role.name == "Admin" > end > def seller? > self.role.name == "Seller" > As the error sa

Re: [Rails] Re: RBAC_CANCAN

2017-07-18 Thread babacar thiam
hi i have a mistake since this morning . undefined method `name' for nil:NilClass Extracted source (around line *#15*): 13 14 15 16 17 18 end def admin? self.role.name == "Admin" end def seller? self.role.name == "Seller" Le mardi 18 juillet 2017 00:07:07 UTC-4, babacar thiam

[Rails] postgresql query

2017-07-18 Thread Joe Guerra
I was wondering if I can create a new field in a table and put a sub query in it? Thanks, Joe -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrail

[Rails] Re: Help with gestalt of Pundit's authorize, please

2017-07-18 Thread Frederick Cheung
> > >> On Monday, July 17, 2017 at 1:08:08 PM UTC+1, Ralph Shnelvar wrote: > > While I'm at it ... > > In > > authorize(@post) > > WHAT is being "authorize-d"? The @post ? The current_user ? The > controller action ? Something else ? > > All 3: this checks that the current user can perform a

[Rails] Re: Help with gestalt of Pundit's authorize, please

2017-07-18 Thread Frederick Cheung
On Monday, July 17, 2017 at 8:02:11 AM UTC+1, Ralph Shnelvar wrote: > > > authorize(@post) > means ... > > For the current user (i.e. current_user) and > for the @post object > throw a NotAuthorizedError exception if PostPolicy#create? returns false > > > > I think the "hidden" inputs to authoriz

[Rails] Re: "output" name collission with RSpec::Matchers::BuiltIn::Output

2017-07-18 Thread Frederick Cheung
On Sunday, July 16, 2017 at 6:17:56 PM UTC+1, Ralph Shnelvar wrote: I suspect I have a name collision with *Class: > RSpec::Matchers::BuiltIn::Output* > > but > I'm damned if I can figure out why. > >

[Rails] Re: Rspec: expect(response).to have one of several valid values

2017-07-18 Thread Frederick Cheung
On Sunday, July 16, 2017 at 1:43:01 AM UTC+1, Ralph Shnelvar wrote: > > > expect(response).to (have_http_status(200) || have_http_status(302)) > > While syntactically valid, this doesn't work because > have_http_status(200)will > throw an exception before it gets to the have_http_status(302) .

Re: [Rails] Best place to store secret keys in Rails

2017-07-18 Thread Frederick Cheung
On Monday, July 17, 2017 at 10:33:04 PM UTC+1, Walter Lee Davis wrote: > > > > On Jul 17, 2017, at 3:26 PM, Ralph Shnelvar wrote: > > My Rails app is on my own server, then > > > > Does it make a difference if the secret keys are in environment > variables or ~/config/secrets.yml ? > > > > R

Re: [Rails] Best place to store secret keys in Rails

2017-07-18 Thread Phil Edelbrock
> On Jul 17, 2017, at 12:26 PM, Ralph Shnelvar wrote: > > If my code will not be shared, and > > My Rails app is on my own server, then > > Does it make a difference if the secret keys are in environment variables or > ~/config/secrets.yml ? > > Ralph I would say, no, it doesn't matter. A

[Rails] slow index action / search via ransack

2017-07-18 Thread www . ezhubb . com
hi, when i run my index action it takes forever to load up (www.ezhubb.com/search). how can i speed up the mysql / rails process? i do try to limit the results, but this code is not working: @q = MyModel.order("RAND()").limit(100).ransack(:some_field => Date.today ) @q.result(distinct: true).

[Rails] Disabling protect_from_forgery for test environment

2017-07-18 Thread Ganesh Kumar
I have put this code to disable protect_from_forgery for test environment. The code is given below and i have given the code in bold. that is the one i'm talking about.. class ApplicationController < ActionController::Base *protect_from_forgery with: :exception, unless: -> { Rails.env.test? }