Forum: Ruby on Rails Problem with updating model

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Alex (Guest)
on 2006-01-21 02:19
I trying to update DATE type field in MySQL but such errors occurs

      - "can't be blank"
      - "can't be blank"

Spending hours on that, I cann't find the reason

But I've filled "login" "password" "password_confirmation" and
"birthday" fields right.
Also I want password field to be blank, not 40 digit hashed password,
but all others fields to be as they are (retrieved from database table
by ActiveRecord)
So, what's the problem with updating the "birthday" record, and how to
make the password field to be blank?
Thanks a lot.

== template
<%= start_form_tag :action=> "edit" %>
  <%= hidden_field "post", "id", :value => %>
  <%= text_field "edituser", 'login', :size => 30 %>
  <%= password_field "edituser", 'password', :size => 30 %>
  <%= password_field "edituser", 'password_confirmation', :size => 30 %>
  <%= date_select("edituser", 'birthday', :order => [:day, :month,
:year], :start_year => 1931, :end_year => 2001) %>
<%= end_form_tag %>

== controller
def edit
  @edituser = User.find_first(["id = ?",params[:id]])
    if not @edituser.nil?
      @edituser.login = @params[:edituser][:login]
      @edituser.birthday = @params[:edituser][:birthday]
      @edituser.login = @params[:edituser][:login]
      if not @params[:edituser][:password].nil? and
        @params[:edituser][:password] ==
@params[:edituser][:password_confirmation] and
  	@params[:edituser][:password] != ""
  	@edituser.password = @params[:edituser][:password]

== model user
attr_accessor             :password_confirmation
validates_confirmation_of :password
validates_presence_of     :login, :password, :password_confirmation,

== MySQL table users
id       int
login    varchar(40)
password varchar(40)
birthday DATE
This topic is locked and can not be replied to.