Hello, For the first part of your problem, you can check emptiness for your table Example with Example.find(:all).empty? => boolean
For the second part, @object = Example.find(:first) your_path = example_path(@object) Of course you can probably do it with a better looking method, but basically that's it. Cyril 2009/7/10 melomane <[email protected]> > > Hi > In my web application, a table must have only one record. So when > there is no record, user can add a new row to the table, (a add link > is shown) and when a record is already available, user can't add a new > one, he can just edit or destroy it( after destroying the current one, > no more records exist, so he can add a new one). But I don't know how > to check a table for emptiness. > The other problem is when there is one record in table, how can I have > a link to its show action(made by scaffolding), while i don't know the > id. Because if the user destroy the record, its id is not 1 any more. > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

