[Rails] Need help on Handling unauthorized user using petergate

2020-01-08 Thread Uzval Mallepeddi


Imagine a testcase where a specific controller has access privileges for 
its actions.
Let's say there's a controller "Test" and it has actions like "show", 
"new", "create" and i created an access privilege using petergate for 
different roles.
*access user: [show], admin: [new create]*
The test case that's bugging me is that what if the user is NOT 
AUTHENTICATED and want to access a page of this "Test" controller ??
I tried to create a replica of "Test" contoller, create new views for it 
and on form submission, i tried to push the form data into the "Test" 
model. But it's not allowing me to do so as Test controller is linked to 
Test model.

Need help on this !

-- 
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 rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/f171b0f1-6993-440e-a565-70e3b26e53a0%40googlegroups.com.


[Rails] Re: How do I get the devise current_user in javascript

2020-01-08 Thread Uzval Mallepeddi
In application.rb file declare a before_action function that sets the 
current_user into a cookie/session (cookie prefered). Then you can access 
the cookies using "document.cookies" in javascript.

On Wednesday, January 8, 2020 at 10:13:44 PM UTC-5, fugee ohu wrote:
>
> ?
>

-- 
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 rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/9a086fb3-2bdd-4c2f-a80a-9f3d35ffe881%40googlegroups.com.