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