Hi
   I have two date fields in table start_date and end_date .There data
type are datetime.  Now in the view I am accepting values of them as
text fields like  And I am following RailsCast 32

<%= f.text_field :start_date_string, :value => '', :maxlength => 50
%><img src="../images/calendar.png" alt="Calendar" />
<%= f.text_field :end_date_string, :value => '', :maxlength => 50 %><img
src="../images/calendar.png" alt="Calendar" />

And in my model

  validates_presence_of :start_date

  def start_date_string
    start_date.to_s(:db)
  end

  def start_date_string=(start_date_str)
    self.start_date = Time.parse(start_date_str)
  end

  def end_date_string
    end_date.to_s(:db)
  end

  def end_date_string=(end_date_str)
    self.end_date = Time.parse(end_date_str)
  end


   But my problem is validates_presence_of :start_date is not working
Even if I dont give any values to start date it does not show any error
message. Please help


Thanks in advance
Tom
-- 
Posted via http://www.ruby-forum.com/.

-- 
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