Question

Here's my issue,

I have a user that can create business "pages." This user can act on behalf of that business page by doing things like follow other users etc, just like facebook business pages.

The user portion of my application is created and so are the other portions like following other users, but how can I make it so that a user can have multiple businesses, access one of them and act on behalf of that business, then switch between them dynamically. I.E. User can switch to business "A" and follow users, that business will follow a user, and then switch to Business "B" and do the same.

Anyone recommend a gem? maybe a good chunk of code that might get me going. I am having a hard time imagining where to begin, I have created a business model, but need a spark to get it moving.

Any help would be wonderful, thanks!

Was it helpful?

Solution

You might want to look at the declarative_authorization gem, which allows you to set rules when a user is allowed to use certain methods on models. e.g. you can have a table which models if a user is the representative of a page, and then use that table/model in the rules used in declarative_authorization.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top