and couldn’t select Espanol.
I’ve had issues with the language box in Safari 5, I can’t select Espanol. the code for that is in: store.html.erg
Anyone knows the answer?
<%= select_tag 'locale', options_for_select(LANGUAGES, I18n.locale), :onchange => 'this.form.submit()' %>
On mine (Rails 2.3.8) I had to add .to_s to I18n.locale as it returns a symbol, not a string.
<%= select_tag 'locale', options_for_select(LANGUAGES, I18n.locale.to_s), :onchange => 'this.form.submit()' %>
This refers to Playtime Task 2, Activity 2I have added a helper to application_helper.rb
Then in app/views/store/index.html.erb I utilize the helper
def currency_to_locale(price) price = price * 1.3 if 'es' == I18n.locale.to_s number_to_currency price end
... currency_to_locale(product.price) %> ...And also in app/views/store/_line_item.html.erb
And finally in app/views/carts/_cart.html.erb
... <td class="item_price"><%= currency_to_locale(line_item.total_price) %></td> ...
This works fine in the browser. But the functional and integration test fails each with the same error
... <td class="total_cell"><%= currency_to_locale(cart.total_price) %></td> ...
test_shipping_the_product(UserStoriesTest): ActionView::Template::Error: undefined method `currency_to_locale' for #<#<Class :0x00000004882c88>:0x00000004990b70> ~/work/depot/app/views/line_items/_line_item.html.erb:9:in `_app_ views_line_items__line_item_html_erb___4544981081009683343_38610780'
A solution to the problem can be found hereYou have to add following to test/test_helper.rb
require './app/helpers/application_helper' require ApplicationHelper
Then the test should run without errors