Implementing a Frontend/Backend structure

Hi folks, I am playing around with Ruby on Rails and, probably like most of the beginners, I started by writing a blog-application.

My questions is, if there is a special way to build something like a frontend/backend structure. As you might (or probably) know, the frontend should just give out a database record and you can update or delete it within the backend. I could do this with two seperated models/controllers, but I wondered if there is a better way.

Looking forward to your answers. Thanks Tim

Hi Tim,

Have you tried using TYPUS - https://github.com/fesplugas/typus

It is quite easy to use and once you do a rails g typus you can get rid of your forward facing admin files.

Hope this helps

Robbie

Hi folks,

I am playing around with Ruby on Rails and, probably like most of the

beginners, I started by writing a blog-application.

My questions is, if there is a special way to build something like a

frontend/backend structure.

As you might (or probably) know, the frontend should just give out a

database record and you can update or delete it within the backend.

I could do this with two seperated models/controllers, but I wondered if

there is a better way.

Yes! That is what MVC does… your views are your ‘front end’ and your models are your ‘back end’. So if you have a model for Posts and a View for Posts you already have such a structure.

Hi folks,

      I am playing around with Ruby on Rails and, probably like most

of the

      beginners, I started by writing a blog-application.



      My questions is, if there is a special way to build something

like a

      frontend/backend structure.

      As you might (or probably) know, the frontend should just give

out a

      database record and you can update or delete it within the

backend.

      I could do this with two seperated models/controllers, but I

wondered if

      there is a better way.
      Yes! That is what MVC does.... your views are your 'front end'

and your models are your ‘back end’. So if you have a model for Posts and a View for Posts you already have such a structure.

With my question I did't aim to get an answer describing the

technical meaning of Frontend and Backend.

I am familiar with the MVC pattern.

I was thinking from the perspective of the user.

I may expressed myself wrong/misleading and should replace the words

“Frontend” and “Backend” with “User-Interface” and “Admin-Interface”.

For example in wordpress, you have got a "frontend" where the user

reads the posts, comments on them, etc and a “backend” where you can login and administrate the site, write new posts, etc

If you think of these as different interfaces then different controllers may be what you want (not different models of course, multiple controllers can access the same models). If there are different levels of users then this may be best served by something like cancan.

Colin

Thanks. In addition I found namespace-routing (Rails Routing from the Outside In — Ruby on Rails Guides under 2.6), which is what I was looking for.

Interesting. I'll have a look on it and maybe give it a try.

Thanks. Tim