I have 2 controller phone phones_feature I want to give a link from phone index page to phones_feature index page and also my link is an image here is my code <%=link_to image_tag(phone.image, :class => ''list_image''),:id=>phone.id %> I wrote this but it doesnt work I am new I look exemples here is my phones_feature controller def index @phones=Phone.find(params[:id]) respond_to do |format| format.html # index.html.erb format.json { render json: @phones } end end pls dont give me alink to http://api.rubyonrails.org/ I already read there still I could not do it I look alot of example on internet -- Posted via http://www.ruby-forum.com/. -- 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-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On 25 April 2013 09:36, cihad yildiz <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I have 2 controller > phone > phones_feature > I want to give a link from phone index page to phones_feature index page > and also my link is an image > here is my code > > <%=link_to image_tag(phone.image, :class => ''list_image''),:id=>phone.id > %>Get it working without the image_tag first, just as a simple link. Then add the image tag. Also if it still "doesn''t work" tell us what did not work. Also have a look at the html generated and check the html is correct.> > I wrote this but it doesnt work I am new I look exemplesHave you worked right through a good tutorial such as railstutorial.org, which is free to use online? If not then I suggest that would be a good idea to show you the basics of Rails. Colin -- 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-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
I canged my link it is no longer image it is model part and phone index.html.erb <% @phones.each do |phone| %> <tr> <td><%=image_tag(phone.image, :class => ''list_image'')%></td> <td><%= phone.brand %></td> <td><%= link_to "#{phone.model}", :controller => :phones_feature_controller, :action => :index,:id => :phone.id %></td> <td><%= phone.ops %></td> <td><%= phone.price %></td> </tr> <% end %> and phones_feature_controller def index @phones = Phone.all respond_to do |format| format.html # index.html.erb format.json { render json: @phones } end end eror is :No route matches {:controller=>"phones_feature_controller"} -- Posted via http://www.ruby-forum.com/. -- 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-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On 25 April 2013 10:32, cihad yildiz <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I canged my link it is no longer image it is model part andPlease quote the previous reply and insert you reply into it at the appropriate points so that it is easier to follow the thread. Remember that this is a mailing list not a forum (though you may be accessing it via a forum like interface).> > phone index.html.erb > <% @phones.each do |phone| %> > <tr> > <td><%=image_tag(phone.image, :class => ''list_image'')%></td> > <td><%= phone.brand %></td> > <td><%= link_to "#{phone.model}", :controller => > :phones_feature_controller, :action => :index,:id => :phone.id %></td> > <td><%= phone.ops %></td> > <td><%= phone.price %></td> > > </tr> > <% end %> > > and phones_feature_controller > > def index > @phones = Phone.all > > respond_to do |format| > format.html # index.html.erb > format.json { render json: @phones } > end > end > > eror is :No route matches {:controller=>"phones_feature_controller"}Have you put an entry in routes.rb for the phones_feature_controller? You did not answer my query as to whether you have worked right through a good tutorial. If you had then I would have expected you to know that this error is probably caused by something missing from routes.rb. Colin -- 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-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
yes I am watching a tutorial I add routes that get "phones_feature/index" get "phone/index" get "phone/show" get "phone/new" I watch a video I use the same code but I had an error ( link_to ("#{phone.model}",phones_feature_index_path) it shows this line I am sorry Ill keep in mind -- Posted via http://www.ruby-forum.com/. -- 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-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On 25 April 2013 11:39, cihad yildiz <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: I asked that you quote the previous message, and insert your reply inline, which you have not done.> yes I am watching a tutorialIs it a Rails 3 tutorial? It should be.> > I add routes > that > get "phones_feature/index" > get "phone/index" > get "phone/show" > get "phone/new"That is not the way to do it any more. I think you must be following a very old tutorial. Make sure that you are using a Rails 3 tutorial and that you are using exactly the version of rails that the tutorial is for. As I suggested previously (I think, since you have not quoted the previous message I am not sure) railstutorial.org is good. Also make sure you restart the server when you change routes.rb. Colin> > > I watch a video > I use the same code > but I had an error > ( link_to ("#{phone.model}",phones_feature_index_path) it shows this > line > > I am sorry Ill keep in mind > > -- > Posted via http://www.ruby-forum.com/. > > -- > 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-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > >-- 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-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.