Basic doubt in MVC - RoR

58 views
Skip to first unread message

Rita Ferreira

unread,
Aug 31, 2013, 6:18:38 PM8/31/13
to rubyonra...@googlegroups.com
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

Dheeraj Kumar

unread,
Aug 31, 2013, 10:25:23 PM8/31/13
to rubyonra...@googlegroups.com
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.

-- 
Dheeraj Kumar

--
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/8be98eb6-526b-4efe-ab4c-281b31e045a3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Pandya, Amit

unread,
Sep 1, 2013, 12:08:24 AM9/1/13
to rubyonra...@googlegroups.com

just do google "rails tutorial", click on very first search result link ;-)

Colin Law

unread,
Sep 1, 2013, 6:55:45 AM9/1/13
to rubyonra...@googlegroups.com
On 1 September 2013 05:08, Pandya, Amit <a.p.p...@gmail.com> wrote:
> just do google "rails tutorial", click on very first search result link ;-)

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
> https://groups.google.com/d/msgid/rubyonrails-talk/CAAVKU-O%3D3Z_C8TnSsTasEVr1u2Kb4e6O1uCtDvf_dQnaUBwdRA%40mail.gmail.com.

Robin Solanki

unread,
Sep 1, 2013, 2:07:13 PM9/1/13
to rubyonra...@googlegroups.com
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. 

and...@benjamin.dk

unread,
Sep 7, 2013, 6:58:39 PM9/7/13
to rubyonra...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages