francesc/translate_routes — Issue #2: translate_route issue
Author: piccio
Created: 2011-11-08 15:24:55+00:00
State: open

I found a problem in when loading 'ActionDispatch::Routing::Translator.translate_from_file('config', 'routes.yml')'

i'm using rails 3.0.10, ruby1.9.2-p290 and translate_routes 3.0.3 from your repository

my yml translate file 'routes.yml' is:

it:
manager: amministrazione
users: utenti
classrooms: aule
activities: attivita
sites: strutture
subjects: materie
teachers: insegnanti
events: eventi
groups: gruppi
series: serie
new: nuovo
edit: modifica
calendar: calendario
move: muovi
resize: ridimensiona
audit: cronologia

and i get this error:
TypeError: can't convert Array into String
from /home/piccio/.rvm/gems/ruby-1.9.2-p290@conservatory/gems/actionpack-3.0.10/lib/action_dispatch/routing/route.rb:25:in `initialize'
from /home/piccio/.rvm/gems/ruby-1.9.2-p290@conservatory/gems/actionpack-3.0.10/lib/action_dispatch/routing/route.rb:25:in `new'
from /home/piccio/.rvm/gems/ruby-1.9.2-p290@conservatory/gems/actionpack-3.0.10/lib/action_dispatch/routing/route.rb:25:in `block in initialize'
from /home/piccio/.rvm/gems/ruby-1.9.2-p290@conservatory/gems/actionpack-3.0.10/lib/action_dispatch/routing/route.rb:24:in `each'
from /home/piccio/.rvm/gems/ruby-1.9.2-p290@conservatory/gems/actionpack-3.0.10/lib/action_dispatch/routing/route.rb:24:in `inject'
from /home/piccio/.rvm/gems/ruby-1.9.2-p290@conservatory/gems/actionpack-3.0.10/lib/action_dispatch/routing/route.rb:24:in `initialize'
from /home/piccio/.rvm/gems/ruby-1.9.2-p290@conservatory/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:299:in `new'
from /home/piccio/.rvm/gems/ruby-1.9.2-p290@conservatory/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:299:in `add_route'
from /home/piccio/.rvm/gems/ruby-1.9.2-p290@conservatory/bundler/gems/translate_routes-33905f78cd94/lib/route_translator.rb:161:in `block (2 levels) in translate'
from /home/piccio/.rvm/gems/ruby-1.9.2-p290@conservatory/bundler/gems/translate_routes-33905f78cd94/lib/route_translator.rb:160:in `each'
from /home/piccio/.rvm/gems/ruby-1.9.2-p290@conservatory/bundler/gems/translate_routes-33905f78cd94/lib/route_translator.rb:160:in `block in translate'
from /home/piccio/.rvm/gems/ruby-1.9.2-p290@conservatory/bundler/gems/translate_routes-33905f78cd94/lib/route_translator.rb:159:in `each'
from /home/piccio/.rvm/gems/ruby-1.9.2-p290@conservatory/bundler/gems/translate_routes-33905f78cd94/lib/route_translator.rb:159:in `translate'
from /home/piccio/.rvm/gems/ruby-1.9.2-p290@conservatory/bundler/gems/translate_routes-33905f78cd94/lib/route_translator.rb:284:in `translate_from_file'
from (irb):1
from /home/piccio/.rvm/gems/ruby-1.9.2-p290@conservatory/gems/railties-3.0.10/lib/rails/commands/console.rb:44:in `start'
from /home/piccio/.rvm/gems/ruby-1.9.2-p290@conservatory/gems/railties-3.0.10/lib/rails/commands/console.rb:8:in `start'
from /home/piccio/.rvm/gems/ruby-1.9.2-p290@conservatory/gems/railties-3.0.10/lib/rails/commands.rb:23:in `'
from script/rails:6:in `require'
from script/rails:6:in `

'

I solved modifing line 208 in route_translator.rb from:

conditions[:request_method] = parse_request_methods route.conditions[:request_method] if route.conditions.has_key? :request_method

to:

conditions[:request_method] = route.conditions[:request_method] if route.conditions.has_key? :request_method

is this the right way?

thank you