Comparing 2 variable

hello

I want to compare 2 variables the variables gets the data from the
database

<% for subnew in @subnews %>

<% if( @news_id == subnew[“news_id”]) %>
.
.
.
.
.
action
.
.
.
.
end

the news_id is getting the value from the controller but when comparing
in rails they want <%= news_id == subnew[“news_id”]) %> where as i want
to make it in @news_id but its not working

please suggest me some new method for it

thanks

try <% if( @news.id.to_s == subnew[“news_id”].to_s) %>

dhaval wrote:

hello

I want to compare 2 variables the variables gets the data from the
database

the news_id is getting the value from the controller but when comparing
in rails they want <%= news_id == subnew[“news_id”]) %> where as i want
to make it in @news_id but its not working

please suggest me some new method for it

thanks

thanks a lot it worked

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs