Ruby on Rails Monday, December 2, 2013

Colin Law wrote in post #1129260:
> On 2 December 2013 21:22, yinwen Xuan <lists@ruby-forum.com> wrote:
>> could you just check why the ruby script not work
>
> Why should I help when you have not followed my request not to top
> post and to remember to quote the previous reply?
>
>>
>> it work when only use the field name : <%= land_area_unit -%>
>>
>> because the the field display not right, when its sqm, it show M2 I want
>> it show m, that's why I want to write a if statement to showing the
>> right unit format:
>>
>> <%= if land_area_unit == M2 %>m&sup2 <% else %> <%= if land_area_unit
>> == HA %>Ha <% else %><%= if land_area_unit == AC %>Ac<% else %>f&sup2
>
>
> There are so many things wrong I don't know where to start. Have a
> look at
> http://www.howtogeek.com/howto/programming/ruby/ruby-if-else-if-command-syntax/.
>
> What is &sup2 intended to be? Should it be &sup2; perhaps.
>
> What are the variables M2 and H2 set to?
>
> Colin

Hi Colin,

I do want to do what you request, but as I explain that I can't edit the
server, view controller etc
the original code on the themes is:
<%= land_area -%><%= land_area_unit -%>
it show on website is 1234 M2
what I want to do is change the M2 to m²
m&sup2; is html to display m² , then I change it to:

<%= land_area -%><%= if land_area_unit == M2 %> m&sup2; <% else %>Ha

Ha is Hectares
but its not work, sorry that I can't do too much following what you
request because I don't know how.
and thanks in advance!

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/caf985e7b1ba479be0d5872c2d185462%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment