Walter Davis wrote in post #1129287:
> On Dec 2, 2013, at 8:33 PM, yinwen Xuan wrote:
>
>>> %> as the container, rather <% %> or <%- %> so as to avoid outputting
>> but not working
> This is the same code I commented on, I don't see that you took up any
> of my suggestions here.
>
> Land Area: <%= land_area %> <%- if land_area_unit == 'M2' %>m²<%-
> else %><%= land_area_unit %><%- end %>
>
> Which could arguably be written a lot more neatly:
>
> Land Area: <%= "#{land_area} #{(land_area_unit == 'M2')? 'm²' :
> land_area_unit}".html_safe %>
>
> Still quite a mess to have in your view, though.
>
> Walter
Hi Walter, your first script is working!! that's great!!!
since the land unit got three others:
AC - Acres
HA - Hectares
F2 - Sq feet
Then I extend your code to the follow, but not working :-(
Land Area: <%= land_area %>
<%- if land_area_unit == 'M2' %>m²
<%- else %><%- if land_area_unit == 'HA' %>Ha
<%- else %><%- if land_area_unit == 'AC' %>Ac
<%- else %>f²<%- end %>
--
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/74345adf3dc7290a9665827bd5e18cf6%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment