Forum: Ruby on Rails hidden fields

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
93692c45272e473a0b4f8cf851a6d23d?d=identicon&s=25 Antonin AMAND (Guest)
on 2006-03-17 11:29
(Received via mailing list)
-----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-----
1aa112c30efa4109f938e7676c3808b6?d=identicon&s=25 Mats Lindblad (Guest)
on 2006-03-17 11:33
(Received via mailing list)
_______________________________________________
Rails mailing list
Rails@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails
93692c45272e473a0b4f8cf851a6d23d?d=identicon&s=25 Antonin AMAND (Guest)
on 2006-03-17 11:54
(Received via mailing list)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mats Lindblad a écrit :
>> 1 - that create_date is set on creation and is never modified after that
> 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 ?

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-----
93692c45272e473a0b4f8cf851a6d23d?d=identicon&s=25 Antonin AMAND (Guest)
on 2006-03-17 12:09
(Received via mailing list)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Antonin AMAND a écrit :
>>>>
>>>  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-----
1aa112c30efa4109f938e7676c3808b6?d=identicon&s=25 Mats Lindblad (Guest)
on 2006-03-17 12:22
(Received via mailing list)
_______________________________________________
Rails mailing list
Rails@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails
This topic is locked and can not be replied to.