Rails app design noob

30 views
Skip to first unread message

Lawrence Pan

unread,
Aug 1, 2015, 12:19:32 AM8/1/15
to rubyonra...@googlegroups.com
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

--
Posted via http://www.ruby-forum.com/.

Thiago Cifani

unread,
Aug 1, 2015, 12:46:24 AM8/1/15
to rubyonra...@googlegroups.com
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
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2715c117818384863b5acc356484114f%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.

Lawrence Pan

unread,
Aug 1, 2015, 12:56:16 AM8/1/15
to rubyonra...@googlegroups.com
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?

Colin Law

unread,
Aug 1, 2015, 3:21:33 AM8/1/15
to Ruby on Rails: Talk
On 1 August 2015 at 05:18, Lawrence Pan <li...@ruby-forum.com> 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

Thiago Cifani

unread,
Aug 1, 2015, 8:36:39 AM8/1/15
to rubyonra...@googlegroups.com
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
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d2850d48e7ae673f7ddd048b4a5dfda7%40ruby-forum.com.

Lawrence Pan

unread,
Aug 1, 2015, 10:45:58 AM8/1/15
to rubyonra...@googlegroups.com
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!
Reply all
Reply to author
Forward
0 new messages