spree/spree_i18n — pull request #354 by tiagoamaro (2014-02-08 02:16:04+00:00)
Title: Option values translations routing error

Hi,

I'm getting a routing error because of the option values translations feature introduced on #348 . This error appears in the following scenario:

1. I'm creating an option type in the admin area
1. After I fill in the option type name and presentation, I click 'Create'
1. The following error appears:

```ruby
Internal Server Error
No route matches {:action=>"index", :controller=>"spree/admin/translations", :id=>"2", :resource=>"option_values", :resource_id=>nil, :format=>nil} missing required keys: [:resource_id]
WEBrick/1.3.1 (Ruby/2.1.0/2013-12-25) at 127.0.0.1:53653
```

Following the log, I found out that the [following deface](/spree/spree_i18n/blob/2-1-stable/app/overrides/spree/admin/option_types/_option_value_fields/add_translation.html.erb.deface#L2) was the culprit.

That didn't make sense at the begging, so I searched for what was the behavior Spree had when creating an option type. I found quite interesting that [it populates](/spree/spree/blob/2-1-stable/backend/app/controllers/spree/admin/option_types_controller.rb#L33-L35) the option type with an option value without id, making the deface for [this Spree view](/spree/spree/blob/2-1-stable/backend/app/views/spree/admin/option_types/edit.html.erb#L35-L44) quite dangerous.

I used the `2-1-stable` branches for both `spree` and `spree_i18n`.

I'm creating a branch in my fork with a regression test for this problem, and a possible solution :)