I am trying to do this conditional statement
<% if(@company.id == params[:id]) %>
Do This
<% end %>
The numbers that it is comparing are the same in the example that I am
trying but it always equates to false. Why would this be.
I am trying to do this conditional statement
<% if(@company.id == params[:id]) %>
Do This
<% end %>
The numbers that it is comparing are the same in the example that I am
trying but it always equates to false. Why would this be.
One other thing, it is saying that
@company.id is a fixnum and I assume that params[:id] is a string
On 10 Jun 2008, at 12:51, Shawn B wrote:
I am trying to do this conditional statement
<% if(@company.id == params[:id]) %>
Do This
<% end %>The numbers that it is comparing are the same in the example that I am
trying but it always equates to false. Why would this be.
because params[:id] is a string.
Fred
On Jun 10, 1:51 pm, Shawn B [email protected] wrote:
I am trying to do this conditional statement
<% if(@company.id == params[:id]) %>
Do This
<% end %>The numbers that it is comparing are the same in the example that I am
trying but it always equates to false. Why would this be.
You’re comparing a fixnum (id) with a string (params) here
<% if(@company.id == params[:id].to_i) %>
should work
params[:id] is actually a string. use params[:id].to_i.
RSL
Thanks everyone, it worked
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs