Ranieri Teixeira
2007-Nov-10 13:40 UTC
Updade distinct model objects in different situations
Hi, I''m writting a rails app to manage mp3 files online. I want to updade distinct model objects in different situations. 1. When an user go to save a new record, I code the controller to save all fields to DB, without restrictions. (this was done). 2. When an user go to save an existing record, two cases can happen: a) the record is of the proper user: so, I want to code the controller to show informations to that user, like "the <file.mp3> has been saved by you. Do you want to edit them?" and display the related form. But, I have another solution: only display the informations and highlight the mp3 entry. What the best solution, for this case? And, if possible, how can I code this? b) the record is of another user: so, I want to code the controller to show a form with unique input fields readonly, like "title" and permit other fields to be salved by the user. But, this time, the field ''description'' will be saved as a comment for the existing entry, in a table comments for the model Comment. How can I code this? When I have a Comment model and need know ''who'' comments ''what'' file, but the Comment belogs_to ''MP3 model'', can I put a user_id field in the comments table? Or would more currect put it in another place? If so, where? Thanks for the support, Ranieri Teixeira --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---