-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I''m a rails newbie trying to develop a blog application with rails. I''ve some troubles to find the best way of automaticly set a field value on update and creation of a blog item. In fact my problem is very simple. I''ve a blog table with two column named create_date an mod_date. And I''d like : 1 - that create_date is set on creation and is never modified after that 2 - mod_date is set on update Pre-Thanks for help. Antonin. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEGo7prvKyD2MLOwsRAvCtAKDP4+EBGg/H1mPjuJfUZBRDEw37aQCfexgO ahyZ1Iu//wqzd7iM4ctFGgU=1icq -----END PGP SIGNATURE-----
Skipped content of type multipart/mixed-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 250 bytes Desc: OpenPGP digital signature Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060317/d4c26e05/signature-0001.bin
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Mats Lindblad a ?crit :> Antonin AMAND wrote: >> Hi, >> >> I''m a rails newbie trying to develop a blog application with rails. I''ve >> some troubles to find the best way of automaticly set a field value on >> update and creation of a blog item. >> >> In fact my problem is very simple. I''ve a blog table with two column >> named create_date an mod_date. And I''d like : >> >> 1 - that create_date is set on creation and is never modified after that >> 2 - mod_date is set on update >> >> Pre-Thanks for help. >> >> Antonin. >> >> >> > I''ll give you a hint: > modified_on DATETIME > and > created_at TIMESTAMPThank you for your quick answer. I understand that all this is about naming conventions ?? _on make the column to be updated when modification is made _at make the column to be set a creation time Am i right ? Also, what if i want some field to be set by some code but not by the user. I have a field ''user_id'', not yet a table representing the user. I''ve seen this is automatically not-displayed in the scaffold. But, how can I set it with some piece of code when the record is created ? Antonin. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEGpT9rvKyD2MLOwsRApYmAJ0V6KiKX5Ld2SLFH5SUqY95c+8VtACfVqNz tThBqpWrvu3tOpCZP3O7TtI=YplM -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Antonin AMAND a ?crit :> Mats Lindblad a ?crit : >>> Antonin AMAND wrote: >>>> Hi, >>>> >>>> I''m a rails newbie trying to develop a blog application with rails. I''ve >>>> some troubles to find the best way of automaticly set a field value on >>>> update and creation of a blog item. >>>> >>>> In fact my problem is very simple. I''ve a blog table with two column >>>> named create_date an mod_date. And I''d like : >>>> >>>> 1 - that create_date is set on creation and is never modified after that >>>> 2 - mod_date is set on update >>>> >>>> Pre-Thanks for help. >>>> >>>> Antonin. >>>> >>>> >>>> >>> I''ll give you a hint: >>> modified_on DATETIME >>> and >>> created_at TIMESTAMP > > Thank you for your quick answer. > > I understand that all this is about naming conventions ?? > _on make the column to be updated when modification is made > _at make the column to be set a creation time > > Am i right ?I''m not ! i''ve just try this, an it doesn''t do what i want. :( modification an creation date can still be modified by the user. Antonin. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEGph9rvKyD2MLOwsRAutMAJkBnW+UWvcgw5/wqfWnCuZSNV3kBgCgjKR2 A7YmqrboAyS/wPrpmxBlau4=cemZ -----END PGP SIGNATURE-----
Skipped content of type multipart/mixed-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 250 bytes Desc: OpenPGP digital signature Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060317/1e22e83a/signature.bin