Rails app design noob

Hi all, I am very new to the rails framework and also web programming in
general. I am currently planning to work on a personal brochure site
which has a simple blogging feature. It is going to be very light so I
did not want to use any blogging engines. What I want is the followings:

  1. Three pages, ‘home’, ‘about’ and ‘blog’;
  2. Two types of post: ‘Micropost’ and ‘regular post’;
  3. One user(which is me) who can create/modify/delete all kinds of
    posts;
  4. There exists user login but no user can be created(except me, it is
    planned to be created within rails console);
  5. On the “home” page, it shows a list of microposts and on the “blog”
    page, it shows all of the regular posts. On the other hand, the about
    page just displays some static texts;

Before I get my hands dirty and start coding, I want to make sure if it
is feasible. I am very new to the concepts of MVC so I am not sure if
the followings are correct.

  1. Create controller ‘pages’ that has ‘home’, ‘about’ and ‘blog’
    actions;
  2. Create ‘user’ model with attribute: ‘name’ and ‘password’;
  3. Create controller ‘session’ for login
  4. Create models ‘micropost’ and ‘posts’ which are belonged to the user;
  5. Create controllers of ‘microposts’ and ‘posts’ for create/destroy;

I am not sure if the following design will work. Also, is it okay if I
do not have a controller for model ‘user’?

Thank you very much

Regards
Lawrence

You can have 2 controllers to input data, the basic pages can represent
actions in a site controller and post can be another one just as session
controller. Any representation of storage data must be related a some
model on rails, you will need to have user, post and other database
related record.

Enviado do meu iPhone

Thiago Cifani wrote in post #1177106:

You can have 2 controllers to input data, the basic pages can represent
actions in a site controller and post can be another one just as session
controller. Any representation of storage data must be related a some
model on rails, you will need to have user, post and other database
related record.

Enviado do meu iPhone

Thank you very much for your reply Thiago.

I am still a bit confused. So according to you, the layout will be like
the followings?:

  1. Create two controllers for the two types of posts for
    edit/create/delete posts respectively;
  2. Create three models corresponding to ‘User’, ‘microposts’ and
    ‘posts’(I am not really familiar with the terms. Database related
    records are just models right?)
  3. Create the ‘page’ controller to control the static pages;
  4. Create a session controller to manage the posts

Is it what should I do?

Thank you very much

Regards
Lawrence

On 1 August 2015 at 05:18, Lawrence P. [email protected] wrote:

Hi all, I am very new to the rails framework and also web programming in
general. I am currently planning to work on a personal brochure site
which has a simple blogging feature. It is going to be very light so I
did not want to use any blogging engines.

Start by working right through a good tutorial such as
railstutorial.org (which is free to use online). That will show you
the basics of Rails. In fact I think that tutorial will cover most,
if not all, of the questions you have raised.

Colin

That is exactly what I said. Database related records are represented by
models. There are some gems that you can use to have a simple auth
control.

Have a nice day

Enviado do meu iPhone

Thiago Cifani wrote in post #1177115:

That is exactly what I said. Database related records are represented by
models. There are some gems that you can use to have a simple auth
control.

Have a nice day

Enviado do meu iPhone

Thank you very much!