John Anderson
2010-Sep-04 04:16 UTC
[newbie question]how to add a new view to a exist controller?
hello everybody , I am a newbie to Rails'' world. I just start reading the book <Agile web Development with rails> one question. How can I add a new view to a exist controller? we can use code: rails generate controller controller_1_name [view_1_name view_2_name] however. if I wanna add a view_3 to controller_1, how can I do with a single line command? I have tried two ways First: rails generate controller controller_1_name view_3_name conflict Second rails generate controller controller_1_name [view_1_name view_2_name view_3_name] still conflict Does anyone have a solution? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sep 4, 5:16 am, John Anderson <jno...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> hello everybody , I am a newbie to Rails'' world. > I just start reading the book <Agile web Development with rails> > one question. > How can I add a new view to a exist controller? > > we can use > code: > rails generate controller controller_1_name [view_1_name > view_2_name] > > however. if I wanna add a view_3 to controller_1, how can I do with a > single line command?could you not just create app/views/controller_1/view_3.html.erb? Fred> > I have tried two ways > First: > rails generate controller controller_1_name view_3_name > conflict > Second > rails generate controller controller_1_name [view_1_name > view_2_name view_3_name] > still conflict > > Does anyone have a solution?-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thank you for replying. Yes. I can just create a view_3.html.erb and add a new definition for view_3 as def view_3 # some code end Is there no way to create all of them just by enter single line command ? Maybe in Rails 4 :D ? On Sep 4, 5:31 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sep 4, 5:16 am, John Anderson <jno...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > hello everybody , I am a newbie to Rails'' world. > > I just start reading the book <Agile web Development with rails> > > one question. > > How can I add a new view to a exist controller? > > > we can use > > code: > > rails generate controller controller_1_name [view_1_name > > view_2_name] > > > however. if I wanna add a view_3 to controller_1, how can I do with a > > single line command? > > could you not just create app/views/controller_1/view_3.html.erb? > > Fred > > > > > > > I have tried two ways > > First: > > rails generate controller controller_1_name view_3_name > > conflict > > Second > > rails generate controller controller_1_name [view_1_name > > view_2_name view_3_name] > > still conflict > > > Does anyone have a solution?-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.