Pt-J-2
I had a similar problem. It turned out that i made a typo in store_controller.erb. In the index action, instead of
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
On mine (Rails 2.3.8) I had to add .to_s to I18n.locale as it returns a symbol, not a string.
Pierre says:
if params[:set_locale]
I wrote
if params[:locale]
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
<%= select_tag 'locale', options_for_select(LANGUAGES, I18n.locale), :onchange => 'this.form.submit()' %>
Anyone knows the answer?
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()' %>
Pierre says:
This refers to Playtime Task 2, Activity 2
I have added a helper to application_helper.rb
def currency_to_locale(price)
price = price * 1.3 if 'es' == I18n.locale.to_s
number_to_currency price
end
Then in app/views/store/index.html.erb I utilize the helper
...
currency_to_locale(product.price) %>
...
And also in app/views/store/_line_item.html.erb
...
<td class="item_price"><%= currency_to_locale(line_item.total_price) %></td>
...
And finally in app/views/carts/_cart.html.erb
...
<td class="total_cell"><%= currency_to_locale(cart.total_price) %></td>
...
This works fine in the browser. But the functional and integration test fails each with the same error
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 here
You have to add following to test/test_helper.rb
require './app/helpers/application_helper'
require ApplicationHelper
Then the test should run without errors