Another approach to checking for emptyness in case you need it: Table.count.zero?
On Jul 10, 11:53 am, melomane <[email protected]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---

