Forum: Ruby on Rails Calculated fixtures

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.
Bahadır D. (Guest)
on 2007-07-30 21:04
Hello,

I want to prepare fixtures to insert into the table. but one column
needs to be calculated before inserting. For example, the password field
must be recorded as MD5(password) (MD5 of password). how can i do this?
Hugh S. (Guest)
on 2007-07-30 21:16
(Received via mailing list)
On Mon, 30 Jul 2007, Bahadır DoÄ~_an wrote:

>
> Hello,
>
> I want to prepare fixtures to insert into the table. but one column
> needs to be calculated before inserting. For example, the password field
> must be recorded as MD5(password) (MD5 of password). how can i do this?

Fixtures accept ERB templating syntax so you can put your
calculations as ruby code between <%= ... %> etc.  See the recent
thread about my problems using ERB which were actually due to bugs
in my expanded code.

        HTH
        Hugh
This topic is locked and can not be replied to.