user2536938
user2536938

Reputation:

Unable to create separate tables for each user with Devise and Rails 4

I am a Rails newbie and I `m creating my very first Rails App with Bootstrap and MySQL as a database.

My question is: How can I create a new table, or record, for each new user of my app ? I made a simple test and any user can see and delete the data from another user.

My application is like a online store, so I need that each vendor can create their products (Because they need to control their own supply) and show to any user that wants to buy that product. Like a online shop.

I checked the similar questions, but I didn`t find anything related.

Now I `m running Rails 4.2.5.2, ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14], using Rubymine as IDE, and Mac OSX Yosemite as OS.

Upvotes: 1

Views: 66

Answers (1)

Patrick Long
Patrick Long

Reputation: 11

I'd recommend using Devise + CanCanCan + Rolify to authenticate your users and assign permissions based on their individual roles i.e Admins can Create/Delete Edit or Users can only View.

Here is a Tutorial On how to install and use each of these gems.

Upvotes: 1

Related Questions