Search code examples
ruby-on-railsarchitecturemodelscaffolding

rails scaffolding separating frontend from backend


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


Solution

  • 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.