views:

8

answers:

0

I have a setter method (below) that works perfectly under Ruby 1.8 but broke when I moved to 1.9. In the controller I could create a task with:

@task = Task.new(params[:task])

under 1.9 I have to do

@task = Task.new(params[:task])
@task.due_at = params[:task][:due_at]

Is there something about mass assignment I'm missing? Thanks!

class Task < History

  attr_accessor :due_at

  def due_at=(due_at)
    self.due = case due_at
    when "Today"     then lambda {Time.now}.call
    when "Tomorrow"  then lambda {Time.now.tomorrow}.call
    when "Next Week" then lambda {Time.now.next_week}.call
    end
  end

end