Restrict Access to Create Action to Particular User Model?

I have two user models one for businesses and one for buyers. How would
I be able to restrict the create method only for businesses and allow
the show actions only for buyers?

On 8 January 2015 at 20:01, David W. [email protected] wrote:

I have two user models one for businesses and one for buyers. How would
I be able to restrict the create method only for businesses and allow
the show actions only for buyers?

Have a look at the cancan gem for handling roles.

Colin

Colin L. wrote in post #1166335:

On 8 January 2015 at 20:01, David W. [email protected] wrote:

I have two user models one for businesses and one for buyers. How would
I be able to restrict the create method only for businesses and allow
the show actions only for buyers?

Have a look at the cancan gem for handling roles.

Colin

Alright, I will check it out. thank you.

David,

Have a look at pundit gem as well. I’d recommend that for simplicity.

Vivek

Jason Fb wrote in post #1166396:

On that note, I think cancan is cancancan now?

(GitHub - ryanb/cancan: Authorization Gem for Ruby on Rails. vs
GitHub - CanCanCommunity/cancancan: The authorization Gem for Ruby on Rails.)

Does anyone know what happened there? I think Ryan B. took a break or
something?

Jason Fleetwood-Boldt
[email protected]
http://www.jasonfleetwoodboldt.com/writing

All material © Jason Fleetwood-Boldt 2014. Public conversations may be
turned into blog posts (original poster information will be made
anonymous). Email [email protected] with questions/concerns about
this.

I installed the original cancan. Which is working, but I have the
slightest clue to what’s going on with cancancan.

On that note, I think cancan is cancancan now?

(GitHub - ryanb/cancan: Authorization Gem for Ruby on Rails. vs
GitHub - CanCanCommunity/cancancan: The authorization Gem for Ruby on Rails.)

Does anyone know what happened there? I think Ryan B. took a break or
something?


You received this message because you are subscribed to the Google G. “Ruby
on Rails: Talk” group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLtLMJ-AMAfaMefRM7LngwkSbcm2hHs7B153KaQkS5cYhw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Jason Fleetwood-Boldt
[email protected]

All material © Jason Fleetwood-Boldt 2014. Public conversations may be
turned into blog posts (original poster information will be made
anonymous). Email [email protected] with questions/concerns about
this.

unknown wrote in post #1166545:

+1 for Pundit. I prefer it over CanCan these days, especially for your
use-case.

Jim

Alright, I’ll uninstall CanCan for Pundit. Thanks.

On 12 January 2015 at 21:28, David W. [email protected]
wrote:

unknown wrote in post #1166545:

+1 for Pundit. I prefer it over CanCan these days, especially for your
use-case.

Jim

Alright, I’ll uninstall CanCan for Pundit. Thanks.

Try them both and then use the one that most suits your needs. Anyway
you do not need to uninstall cancan, just remove if from Gemfile and
insert pundit instead (plus making any changes to the code of course).

Colin

+1 for Pundit. I prefer it over CanCan these days, especially for your
use-case.

Jim

Colin L. wrote in post #1166563:

On 12 January 2015 at 21:28, David W. [email protected]
wrote:

unknown wrote in post #1166545:

+1 for Pundit. I prefer it over CanCan these days, especially for your
use-case.

Jim

Alright, I’ll uninstall CanCan for Pundit. Thanks.

Try them both and then use the one that most suits your needs. Anyway
you do not need to uninstall cancan, just remove if from Gemfile and
insert pundit instead (plus making any changes to the code of course).

Colin

Sounds cool. Thank you.