I have one controller(home) with two methods(empty) ,name are index,new).Corressponding have 2 .html.erb files in home view.How to give a link from file index.html.erb to new.html.erb i.e syntax? I tried <%=link_to ''Click me'',home_new_path%>,but it failed Thanks -- 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.
Hassan Schroeder
2011-Apr-29 15:33 UTC
Re: How to give link between two files of same view?
On Fri, Apr 29, 2011 at 8:08 AM, amrit pal pathak <amritpalpathak1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have one controller(home) with two methods(empty) ,name are > index,new).Corressponding have 2 .html.erb files in home view.How to > give a link from file index.html.erb to new.html.erb i.e syntax? > I tried <%=link_to ''Click me'',home_new_path%>,but it failedFYI, "it failed" is not a very useful problem description. Regardless, you should be able to see the proper syntax if you run `rake routes`, and you should be able to easily confirm that the path is correct in the generated page via `view source` in your browser. HTH, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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.
amrit pal pathak
2011-Apr-30 05:47 UTC
Re: How to give link between two files of same view?
On Apr 29, 11:33 am, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Fri, Apr 29, 2011 at 8:08 AM, amrit pal pathak > > <amritpalpath...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I have one controller(home) with two methods(empty) ,name are > > index,new).Corressponding have 2 .html.erb files in home view.How to > > give a link from file index.html.erb to new.html.erb i.e syntax? > > I tried <%=link_to ''Click me'',home_new_path%>,but it failed > > FYI, "it failed" is not a very useful problem description. > > Regardless, you should be able to see the proper syntax if you run > `rake routes`1) rake routes say: (in /home/amrit/mani) home_index GET /home/index(.:format) {:action=>"index", :controller=>"home"} 2) Then i changed the syntax in index.html.erb file as: <%=link_to "Goodbyyye",:action=>"new", :controller=>"home"%> Again strucked error,says: No route matches {:controller=>"home", :action=>"new"} Thank you -- 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.
rajeevsharma86
2011-Apr-30 06:52 UTC
Re: Re: How to give link between two files of same view?
Check yours routes.rb write there map.resources "controller_name" On Sat, Apr 30, 2011 at 11:17 AM, amrit pal pathak < amritpalpathak1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Apr 29, 11:33 am, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > On Fri, Apr 29, 2011 at 8:08 AM, amrit pal pathak > > > > <amritpalpath...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I have one controller(home) with two methods(empty) ,name are > > > index,new).Corressponding have 2 .html.erb files in home view.How to > > > give a link from file index.html.erb to new.html.erb i.e syntax? > > > I tried <%=link_to ''Click me'',home_new_path%>,but it failed > > > > FYI, "it failed" is not a very useful problem description. > > > > Regardless, you should be able to see the proper syntax if you run > > `rake routes` > > 1) rake routes say: > (in /home/amrit/mani) > home_index GET /home/index(.:format) > {:action=>"index", :controller=>"home"} > > 2) Then i changed the syntax in index.html.erb file as: > <%=link_to "Goodbyyye",:action=>"new", :controller=>"home"%> > > Again strucked error,says: > No route matches {:controller=>"home", :action=>"new"} > > Thank you > > -- > 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. > >-- Thanks: Rajeev sharma -- 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 30 April 2011 06:47, amrit pal pathak <amritpalpathak1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Apr 29, 11:33 am, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> On Fri, Apr 29, 2011 at 8:08 AM, amrit pal pathak >> >> <amritpalpath...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > I have one controller(home) with two methods(empty) ,name are >> > index,new).Corressponding have 2 .html.erb files in home view.How to >> > give a link from file index.html.erb to new.html.erb i.e syntax? >> > I tried <%=link_to ''Click me'',home_new_path%>,but it failed >> >> FYI, "it failed" is not a very useful problem description. >> >> Regardless, you should be able to see the proper syntax if you run >> `rake routes` > > 1) rake routes say: > (in /home/amrit/mani) > home_index GET /home/index(.:format) > {:action=>"index", :controller=>"home"} > > 2) Then i changed the syntax in index.html.erb file as: > <%=link_to "Goodbyyye",:action=>"new", :controller=>"home"%> > > Again strucked error,says: > No route matches {:controller=>"home", :action=>"new"}That is because, once again, you have not defined the route for that action. I have lost count of how many times I have suggested that you work through the Rails Guide on routing. Read it again and if there is anything that you do not understand then ask here for clarification. It is clear that you still have not grasped the basics of rails routing. Colin -- 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.