--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/xnmAl4-br4IJ.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Also, you could clean things a little by doing:<% @update_coupon.select{|doc| doc["value"] == 2}.each do |doc| %>do stuff<% end %>
On Tue, May 22, 2012 at 7:02 PM, Guilherme Dutra <guiper...@gmail.com> wrote:
I don't know if is the best solution but try a cast with to_i in doc["value"].
doc["value"] .to_i
On Tue, May 22, 2012 at 10:29 AM, amvis <vgrkr...@gmail.com> wrote:
controller@update_coupon = JSON.parse(get_updatecpn.body)view1, <% @update_coupon.each do |doc| %>2, <% if doc["value"] == 2 %>3, <%end%>Here the @update_coupon getting from controller,In the controller i got all the value from @update_coupon so i need to take the value from this @update_coupon in view. so when i am trying to take the value from the @update_coupon, it gives an error can't convert string to integer in line 2have any other way to do this view?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/xnmAl4-br4IJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
--
Atenciosamente,
Guilherme Pereira Dutra,
Fone: (34) 8407-0109
--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
Assuming @update_coupon is an array of a class having a value attribute, that would return a hash much alike:
On Tuesday, 22 May 2012 10:23:53 UTC-4, Juan Pablo Avello wrote:
El martes, 22 de mayo de 2012 15:56:54 UTC+2, amvis escribió:
On Tuesday, 22 May 2012 09:34:20 UTC-4, azizmb.in wrote:Also, you could clean things a little by doing:<% @update_coupon.select{|doc| doc["value"] == 2}.each do |doc| %>do stuff<% end %>Thanks alli think the above one is working, but i am confused with other problem, here in my code<% @update_coupon.each do |doc| %><% if doc["value"] == 2 %>//code<%elsif doc["value"] == 5 %>//code<%elsif doc["value"] == 6 %>//code<%end%><%end%>
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/zYGz_lHMVYUJ.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.