0

First of all, I have only worked with scaffolding in rails. What I want to do is I want to separate R in CRUD to different route, so that front end will only have R and the rest of CRUD is in backend.

To achieve this I have two options, generating two scaffolds for the same model, or generating a small controller and view for the front end part. Which choice would be better?

May be I can also use multiple layouts with single controller, but I thought it would be messy with controlling the authentication, am I correct?

My site is not going to be much complicated, not in future either.

Since I want to use devise for authentication, I think it wont be complicated using 2 controllers and 2 views for the same mddel.

Please correct me if I'm wrong. Regards

pahnin
  • 5,367
  • 12
  • 40
  • 57
  • So you want users to be only able to read, and have some sort of an admin which can do CRUD actions? – gerky Sep 16 '12 at 09:11
  • yes, thats exactly what I want to do, may be it can also be done with multiple layouts on a single controller? – pahnin Sep 16 '12 at 09:14
  • You can also do that and create a before_filter checking if user is admin on the CRUD actions. But if you're using activerecord, it will save you a lot of time to just use active_admin. – gerky Sep 16 '12 at 09:23
  • yes that looks like straight forward method of what I want to achieve. – pahnin Sep 16 '12 at 09:26

1 Answers1

0

From what I understand, you do not want to have all the CRUD actions for your user. I am not sure though what you mean by generate two scaffolds for the same model.

But yes, based on the requirements you gave, you should be fine with generating two controllers/views for the model.

But if you're using ActiveRecord and want backend/admin functionality, you may want to check out active_admin. It automatically generates the admin part of your application, which can be very helpful.

Also check out the active_admin railscast.

gerky
  • 6,267
  • 11
  • 55
  • 82