Since the params will give you either "0" or "1" as a string, and
since you are trying to equate "0" (string) to "false" (boolean), why
not set a variable equal to "true" or "false" based on the params?
Try:

if params[:item][:status] == "0"
  bool = false
else
  bool = true
end

or,

bool = (params[:item][:status] != "0")

You can then compare bool to your boolean.



On Jul 25, 1:54 pm, Linus Pettersson <[email protected]>
wrote:
> Hmm, that seems to always return false over here.
> I tried this:
> update_was_successful = @item.update_attributes(params[:item])
> puts @item.status_changed?
>
> Which outputs false, always. The weird thing is that it prints that before
> the update is shown in the console. I guess that is why it's always false.
>
> Isn't the update_attributes method updating the item right away?

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