On 5 July 2012 21:37, cyber c. <li...@ruby-forum.com> wrote: >>>> buggy. >>> >>> >>> >>> Started POST "/trials" for 127.0.0.1 at Thu Jul 05 10:26:19 -0700 2012 >>> (1.2ms) commit transaction >>> Completed 200 OK in 39ms (Views: 37.9ms | ActiveRecord: 0.2ms) >>> >>> >>> >>> Started GET "/assets/trials.js?body=1" for 127.0.0.1 at Thu Jul 05 >>> 10:26:45 -0700 2012 >>> Served asset /trials.js - 304 Not Modified (0ms) >>> >>> >>> >>> The last request "GET /trials" renders only the old records and not the >>> new record that i have just created. > >>There should be some sql fetching the records for the index view. It >>seems it has not fetched the records at all. Can you post >>index.html.erb. Copy/Paste it obviously. If it is large then use >>pastebin.com or similar. > > Index.html.erb : > > <h1>Listing trials</h1>
Change the above line to <h1>Listing trials: count = <%= trials.count %></h1> > > <table> > <tr> > <th>Name</th> > <th>Email</th> > <th></th> > <th></th> > <th></th> > </tr> > > <% @trials.each do |trial| %> > <tr> > <td><%= trial.name %></td> > <td><%= trial.email %></td> > <td><%= link_to 'Show', trial %></td> > <td><%= link_to 'Edit', edit_trial_path(trial) %></td> > <td><%= link_to 'Destroy', trial, :confirm => 'Are you sure?', > :method => :delete %></td> > </tr> > <% end %> > </table> > > <br /> > > <%= link_to 'New Trial', new_trial_path %> Now run the app, bring up the index and note the count shown (what is it and how many records do you see), add a record and then show the index again. Does the count change? Post the log for that complete cycle. If the test is still not showing the new records what happens if you restart the rails server and then show the index? One further point, I find it surprising that the id of the new record is 2. After all this messing about adding records there should be lots there. How many are there? 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@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-US.