On 12 August 2011 16:55, Leonel *.* <[email protected]> wrote:
>>> I have this in users_controller.rb
>>> -----------------------------------------
>>> @user = @company.users.build(params[:user])
>>> @user.invitation_last_sent_at = Time.now
>>> @user.invitation_last_sent_to = ???????
>>
>> What?  You have that line if the controller?
>
> No, I meant I tried those 3 different lines in different times. Here's
> the create method in the users_controller.rb
> -------------------------------------------
> def create
>  @company = Company.find(params[:company_id])
>  @user = @company.users.build(params[:user])
>  @user.user_state = "invited"
>  @user.invitation_last_sent_at = Time.now
>  @user.invitation_last_sent_to = @user.email

Break in here with the debugger and see what is happening.

>
>  respond_to do |format|
>  if @user.save
>    Notifier.user_invited(@user).deliver
>    format.html { redirect_to(users_url, :notice => user_long_name) }
>    format.xml  { render :xml => @user, :status => :created, :location
> => @company }

Presumably you are seeing the above happening, so showing that the
save is working.

>  else
>    format.html { render :action => "new" }
>    format.xml  { render :xml => @company.errors, :status =>
> :unprocessable_entity }

and presumably the above is not happening.

Colin

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