Basic doubt in MVC - RoR

Hi, I’m with a very basic doubt in MVC in RoR. I’m new at RoR, I had never developed an app in Rails since the beggining, just few things separately.

I want to have a sign in page, like the first page the user see.

After sign in I will have another page where I have a menu where user can do the basis operations (new, edit, show, …).

The stuture of the webpage is:

sign_in page → page with basic operations → operations

After creating the controller/views/model to do those operations, in which page should I put the sign in page?

I mean the sign in page is not related to the controller, so on /app/views should I create another file (see below), for instance called index.html.erb?

If controller is named A, I will have the following structure:

/app/controller

  • A_controller.rb

/app/views/A

  • edit.html.erb

  • new.html.erb

  • show.html.erb

  • (index.html.erb) --------> for sign in page?

  • (index_2.html.erb) --------> page with basic operations?

After do the sign in it will be redirected to the page where I will have buttons (for instance) with new, edit, show operations, this page should be another page created by me (again) on the app/views/A ?

How do you do it?

I don’t know if you understand my problem. Please if not tell me, all help is welcome.

Thanks

Rita

You would need a separate controller to handle the sign-in part, with its own views. When it’s successful, it should redirect you to the A controller. This is how most apps do it.

just do google “rails tutorial”, click on very first search result link :wink:

just do google "rails tutorial", click on very first search result link :wink:

Amit is right, work right through a good tutorial such as railstutorial.org (which is free to use online), including all the exercises, then you will be all set to go.

Colin

You’ll need to create a session’s controller to store in the session of the logged user, the MVC you created is good for registrations and all other CRUD related to it.

Rita,

Please take attention to this and do what they are saying. read a turtorial, also I have noticed on another post you had classes with names in portuguese. this is a very bad practice since other people from other countries read ur code and want to help cant understand the semantics. After you work through a tutorial of rails, look at a gem called Devise, which allows you to have users with a great solution without any work(dont need to invent the wheel again…)

Hope it helps and you find ROR fun.

all the best,

Andre