On 4 Oct 2007, at 14:19, Dhaval P. wrote:
Is there any method to write the insert query in the .rhtml file (eg:
-list.rhtml). If so please do let me know. I know that its not the
way out but then in my list.rhtml i m having @email which is storing
email addresses so i
want to store those into my db how could i do that?
It’s not just “not the best”, it’s a very bad idea to perform an
insert from your view.
It seems like you could probably do with reading up on MVC a bit more
. Simply put:
- Your view should show a form requesting input, to be submitted
- Your controller should direct that that request and hand data to
- Your models should take care of storing the data
If you’ve not done so yet, you’d be well advised to spend some time
with one of the many introductory books or online tutorials to see
how rails is designed.