>
> When I add this to my model:
>
>  def after_initialize
>    :date = Date.today
>  end
>
> I get this error --  /home/xxdesmus/timetool/app/models/post.rb:38:
> syntax error, unexpected '=', expecting kEND :date = Date.today ^
>

You will do, you're trying to assign a value to a symbol (which is an
immutable object).


> when I try it this way:
>
>  def after_initialize
>    date = Date.today
>  end
>
> It doesn't do anything ...probably because my field should have a
> different name other than "date" huh?
>

 def after_initialize
   self.date = Date.today
 end

Doing:

date =

Will just assign the value to a local variable.

Cheers,


Andy

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to