Hi Guys,

I'm at a bit of a roadblock as to whether I'm the one in the wrong, or DM is.

See my post on stackoverflow.com for the full version:

http://stackoverflow.com/questions/6087607/functional-test-with-datamapper-model-not-validating-when-it-should-be

In short, my functional test is failing, while when doing an manual test the 
code does appear to work.

I was able to get it working by using my legacy field name in the params to 
#new, which seems like a bug:

i.e.  instead of

def create
  @user = User.get!(params[:user_id])
  @note = AdminUserNote.new({
    :user => active_user,
    :subject => @user,
    :content => params[:content]
  });
  if @note.save
    redirect_to(admin_user_path(@user))
  else
    render :new
  end
end

I had to do:

def create
  @user = User.get!(params[:user_id])
  @note = AdminUserNote.new({
    :user => active_user,
    :subjectid => @user.id, # this is a horrible horrible hack
    :content => params[:content]
  });
  if @note.save
    redirect_to(admin_user_path(@user))
  else
    render :new
  end
end

Is this normal, or is it a bug?  I can't understand why the validation passes 
in the development environment, but fails in the test environment.

Cheers,

Chris

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" 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/datamapper?hl=en.

Reply via email to