Ok..so that's what I mean: I need to create a new view where I want to insert for istance (and in this exact case) a form that I use to upload a file and then process the file. So in first place I create a view "new2.html.erb" in my view folder associated to a controller let's say "references" with a form in it. so now i have in the "view/references" folder this new file
how can I access this view? can I without creating a method? I guess I don't because when I type http://localhost:3000/references/new2 i get that error: "Couldn't find Reference with ID=new2" (but it render the page with the form if I had any kind of id after, i.e. http://localhost:3000/references/new2/1 ) the question is: why for istance the "index" page or the "new" generated by the scaffold can render the page (and the form in case of new) without passing any ID and I can't now? what's the rule underneath? my new2.html.erb page contain this: -- <h1>New reference csv</h1> <% form_for :reference, @references, :method => :get, :url => {:action => 'new'} do %> <p>Filename: <%= text_field_tag "file_tag" %> </p> <p> <%= submit_tag("Carica csv") %></p> <% end %> <%= link_to 'Back', references_path %> -- (I've redefined the new method to parse a csv file) and the routes.rb is the default one given by rails with the only restful defined like this: -- map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format' -- I've tried to add something like: map.connect ':controller/:action.:format' but it does not do the trick .. :D I'd like to understand how this work in general more than solve this particular problem :) thank u all :) andrea On 11 Mar, 22:41, Punit Rathore <li...@ruby-forum.com> wrote: > Andrea, > > You need to provide us with more information. From the info you have > given I cannot figure out what is going on. > > > "Couldn't find Product with ID=new2" > > You say that you have an empty method, but it is trying to find a > Product with ID=new2. I think that it cannot find the correct route from > the routes.rb file. > > Actually you should paste all the code snippets from your controller, > view and routes.rb file. > > Punit > > -- > Posted viahttp://www.ruby-forum.com/. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.