Giter VIP home page Giter VIP logo

route_translator's People

Contributors

aimerickdesdoit avatar arpsara avatar cice avatar dependabot-preview[bot] avatar dependabot[bot] avatar enriclluelles avatar gi-lunaweb avatar gonzoyumo avatar halogenandtoast avatar jacob-carlborg avatar jastix avatar kristianmandrup avatar markusharmsen avatar mohamagdy avatar mpxc8102 avatar mruokojo avatar narnach avatar ncri avatar nielskschjoedt avatar omid-kamangar avatar omnikron avatar paludetto avatar raul avatar rogercampos avatar rsierra avatar salimane avatar stijnster avatar stuarthannig avatar tagliala avatar tute avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

route_translator's Issues

config.translation_file and routes.translate_from_file

You need to include the path to the yaml file this way:

MyApp::Application.routes.translate_from_file("path/to/routes.yml")

If you only set it in the RouteTranslator.config block with config.translation_file you will get an error while starting up the app:

translator.rb:148:in translate_string': undefined method[]' for nil:NilClass (NoMethodError)

So there are two places to set this param, but once you set it in the translate_from_file method, the config.translation_file method is not considered at all.

Maybe is a good idea to homogenize this.

Cheers.

I18n.locale not being set

Hi, the gem works fine. I have set it up according to readme.

However, if I access the I18n.locale via a view to check what language I am in - it is always set to the default language. Everything else (translations, routes, etc.) is working just fine. Is this a bug, or do I miss out on something?

Thanks, G

Rspec error

Hello,

I have installed the lastest version. In the application everything works fine, but when I try to run spec tests I get this error.

/.rvm/gems/ruby-2.0.0-p353/bundler/gems/route_translator-173e2e4bec89/lib/route_translator/translator.rb:28:in dup': can't dup NilClass (TypeError) from /.rvm/gems/ruby-2.0.0-p353/bundler/gems/route_translator-173e2e4bec89/lib/route_translator/translator.rb:28:intranslations_for'
from /.rvm/gems/ruby-2.0.0-p353/bundler/gems/route_translator-173e2e4bec89/lib/route_translator/extensions/route_set.rb:7:in add_localized_route' from /.rvm/gems/ruby-2.0.0-p353/bundler/gems/route_translator-173e2e4bec89/lib/route_translator/extensions/mapper.rb:31:inadd_route'
from/.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1422:in decomposed_match' from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1403:inblock in match'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1394:in each' from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1394:inmatch'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:601:in map_method' from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:562:inget'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1255:in block (2 levels) in resources' from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1288:inblock (2 levels) in collection'
from c/.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:723:in scope' from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1287:inblock in collection'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1540:in with_scope_level' from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1286:incollection'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1254:in block in resources' from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1549:inblock (2 levels) in resource_scope'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:723:in scope' from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1548:inblock in resource_scope'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1540:in with_scope_level' from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1547:inresource_scope'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1249:in resources' from /workspace/appname/config/routes.rb:38:inblock (2 levels) in <top (required)>'
from /.rvm/gems/ruby-2.0.0-p353/bundler/gems/route_translator-173e2e4bec89/lib/route_translator/extensions/mapper.rb:8:in localized' from /workspace/appname/config/routes.rb:36:inblock in <top (required)>'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:341:in instance_exec' from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:341:ineval_block'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:319:in draw' from /workspace/appname/config/routes.rb:1:in<top (required)>'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in load' from /.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:inblock in load'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in load_dependency' from /.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:inload'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in block in load_paths' from /.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:ineach'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in load_paths' from /.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:16:inreload!'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:26:in block in updater' from /.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/file_update_checker.rb:75:incall'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/file_update_checker.rb:75:in execute' from c/.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:27:inupdater'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:6:in execute_if_updated' from /.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/application/finisher.rb:69:inblock in module:Finisher'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/initializable.rb:30:in instance_exec' from /.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/initializable.rb:30:inrun'
from .rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/initializable.rb:55:in block in run_initializers' from /.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:150:inblock in tsort_each'
from /.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:183:in block (2 levels) in each_strongly_connected_component' from /.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:219:ineach_strongly_connected_component_from'
from /.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:182:in block in each_strongly_connected_component' from /.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:180:ineach'
from /.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:180:in each_strongly_connected_component' from /.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/tsort.rb:148:intsort_each'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/initializable.rb:54:in run_initializers' from /.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/application.rb:215:ininitialize!'
from /.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in method_missing' from /workspace/appname/config/environment.rb:5:in<top (required)>'
from /workspace/appname/spec/spec_helper.rb:3:in require' from /workspace/appname/spec/spec_helper.rb:3:in<top (required)>'
from /workspace/appname/spec/models/user_spec.rb:1:in require' from /workspace/appname/spec/models/user_spec.rb:1:in<top (required)>'
from /.rvm/gems/ruby-2.0.0-p353/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in load' from /.rvm/gems/ruby-2.0.0-p353/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:inblock in load_spec_files'
from /.rvm/gems/ruby-2.0.0-p353/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in each' from /.rvm/gems/ruby-2.0.0-p353/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:inload_spec_files'
from /.rvm/gems/ruby-2.0.0-p353/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in run' from /.rvm/gems/ruby-2.0.0-p353/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:inrun'
from /.rvm/gems/ruby-2.0.0-p353/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'

undefined method `hide_locale='

RouteTranslator.config do |config|
  config.hide_locale = true 
end

Just added hide_locale to config and get the error:

rake aborted!
undefined method `hide_locale=' for #<RouteTranslator::Configuration:0x007fd52be05030>

automatically generated routes

i got this problem with routes being generated for too many languages! my 'rake routes' output is very long and it contains routes for langages like italian, french and many others that shortcuts are mystery to me.
i think i set everything correctly:

config.locale_param_key = :my_locale
Using ruby 2.0, Rails 4

tiny, tiny piece of my 'rake routes'

H /dyo/pages/:menu/:id(.:format) pages#update {:my_locale=>"dyo"}
PATCH /dz/pages/:menu/:id(.:format) pages#update {:my_locale=>"dz"}
PATCH /ebu/pages/:menu/:id(.:format) pages#update {:my_locale=>"ebu"}
PATCH /ee/pages/:menu/:id(.:format) pages#update {:my_locale=>"ee"}
PATCH /el/pages/:menu/:id(.:format) pages#update {:my_locale=>"el"}
PATCH /eo/pages/:menu/:id(.:format) pages#update {:my_locale=>"eo"}
PATCH /et/pages/:menu/:id(.:format) pages#update {:my_locale=>"et"}
PATCH /eu/pages/:menu/:id(.:format) pages#update {:my_locale=>"eu"}
PATCH /ewo/pages/:menu/:id(.:format) pages#update {:my_locale=>"ewo"}
PATCH /fa/pages/:menu/:id(.:format) pages#update {:my_locale=>"fa"}
PATCH /ff/pages/:menu/:id(.:format) pages#update {:my_locale=>"ff"}
PATCH /fi/pages/:menu/:id(.:format) pages#update {:my_locale=>"fi"}
PATCH /fil/pages/:menu/:id(.:format) pages#update {:my_locale=>"fil"}
PATCH /fo/pages/:menu/:id(.:format) pages#update {:my_locale=>"fo"}
PATCH /fr-ca/pages/:menu/:id(.:format) pages#update {:my_locale=>"fr-CA"}
PATCH /fur/pages/:menu/:id(.:format) pages#update {:my_locale=>"fur"}
PATCH /ga/pages/:menu/:id(.:format) pages#update {:my_locale=>"ga"}
PATCH /gaa/pages/:menu/:id(.:format) pages#update {:my_locale=>"gaa"}
PATCH /gd/pages/:menu/:id(.:format) pages#update {:my_locale=>"gd"}
PATCH /gl/pages/:menu/:id(.:format) pages#update {:my_locale=>"gl"}
PATCH /gsw/pages/:menu/:id(.:format) pages#update {:my_locale=>"gsw"}
PATCH /gu/pages/:menu/:id(.:format) pages#update {:my_locale=>"gu"}
PATCH /guz/pages/:menu/:id(.:format) pages#update {:my_locale=>"guz"}
PATCH /gv/pages/:menu/:id(.:format) pages#update {:my_locale=>"gv"}
PATCH /ha/pages/:menu/:id(.:format) pages#update {:my_locale=>"ha"}
PATCH /haw/pages/:menu/:id(.:format) pages#update {:my_locale=>"haw"}
PATCH /he/pages/:menu/:id(.:format) pages#update {:my_locale=>"he"}
PATCH /hi/pages/:menu/:id(.:format) pages#update {:my_locale=>"hi"}
PATCH /hr/pages/:menu/:id(.:format) pages#update {:my_locale=>"hr"}
PATCH /hu/pages/:menu/:id(.:format) pages#update {:my_locale=>"hu"}
PATCH /hy/pages/:menu/:id(.:format) pages#update {:my_locale=>"hy"}
PATCH /ia/pages/:menu/:id(.:format) pages#update {:my_locale=>"ia"}
PATCH /id/pages/:menu/:id(.:format) pages#update {:my_locale=>"id"}
PATCH /ig/pages/:menu/:id(.:format) pages#update {:my_locale=>"ig"}
PATCH /ii/pages/:menu/:id(.:format) pages#update {:my_locale=>"ii"}
PATCH /is/pages/:menu/:id(.:format) pages#update {:my_locale=>"is"}
PATCH /ja/pages/:menu/:id(.:format) pages#update {:my_locale=>"ja"}
PATCH /jmc/pages/:menu/:id(.:format) pages#update {:my_locale=>"jmc"}
PATCH /ka/pages/:menu/:id(.:format) pages#update {:my_locale=>"ka"}
PATCH /kab/pages/:menu/:id(.:format) pages#update {:my_locale=>"kab"}
PATCH /kaj/pages/:menu/:id(.:format) pages#update {:my_locale=>"kaj"}
PATCH /kam/pages/:menu/:id(.:format) pages#update {:my_locale=>"kam"}
PATCH /kcg/pages/:menu/:id(.:format) pages#update {:my_locale=>"kcg"}
PATCH /kde/pages/:menu/:id(.:format) pages#update {:my_locale=>"kde"}
PATCH /kea/pages/:menu/:id(.:format) pages#update {:my_locale=>"kea"}
PATCH /khq/pages/:menu/:id(.:format) pages#update {:my_locale=>"khq"}
PATCH /ki/pages/:menu/:id(.:format) pages#update {:my_locale=>"ki"}
PATCH /kk/pages/:menu/:id(.:format) pages#update {:my_locale=>"kk"}
PATCH /kl/pages/:menu/:id(.:format) pages#update {:my_locale=>"kl"}
PATCH /kln/pages/:menu/:id(.:format) pages#update {:my_locale=>"kln"}
PATCH /km/pages/:menu/:id(.:format) pages#update {:my_locale=>"km"}
PATCH /kn/pages/:menu/:id(.:format) pages#update {:my_locale=>"kn"}
PATCH /ko/pages/:menu/:id(.:format) pages#update {:my_locale=>"ko"}
PATCH /kok/pages/:menu/:id(.:format) pages#update {:my_locale=>"kok"}
PATCH /ksb/pages/:menu/:id(.:format) pages#update {:my_locale=>"ksb"}
PATCH /ksf/pages/:menu/:id(.:format) pages#update {:my_locale=>"ksf"}
PATCH /ksh/pages/:menu/:id(.:format) pages#update {:my_locale=>"ksh"}
PATCH /kw/pages/:menu/:id(.:format) pages#update {:my_locale=>"kw"}
PATCH /ky/pages/:menu/:id(.:format) pages#update {:my_locale=>"ky"}
PATCH /lag/pages/:menu/:id(.:format) pages#update {:my_locale=>"lag"}
PATCH /lg/pages/:menu/:id(.:format) pages#update {:my_locale=>"lg"}
PATCH /ln/pages/:menu/:id(.:format) pages#update {:my_locale=>"ln"}
PATCH /lo/pages/:menu/:id(.:format) pages#update {:my_locale=>"lo"}
PATCH /lt/pages/:menu/:id(.:format) pages#update {:my_locale=>"lt"}
PATCH /lu/pages/:menu/:id(.:format) pages#update {:my_locale=>"lu"}
PATCH /luo/pages/:menu/:id(.:format) pages#update {:my_locale=>"luo"}
PATCH /luy/pages/:menu/:id(.:format) pages#update {:my_locale=>"luy"}
PATCH /lv/pages/:menu/:id(.:format) pages#update {:my_locale=>"lv"}
PATCH /mas/pages/:menu/:id(.:format) pages#update {:my_locale=>"mas"}
PATCH /mer/pages/:menu/:id(.:format) pages#update {:my_locale=>"mer"}
PATCH /mfe/pages/:menu/:id(.:format) pages#update {:my_locale=>"mfe"}
PATCH /mg/pages/:menu/:id(.:format) pages#update {:my_locale=>"mg"}
PATCH /mgh/pages/:menu/:id(.:format) pages#update {:my_locale=>"mgh"}
PATCH /mk/pages/:menu/:id(.:format) pages#update {:my_locale=>"mk"}
PATCH /ml/pages/:menu/:id(.:format) pages#update {:my_locale=>"ml"}
PATCH /mn/pages/:menu/:id(.:format) pages#update {:my_locale=>"mn"}
PATCH /mr/pages/:menu/:id(.:format) pages#update {:my_locale=>"mr"}
PATCH /ms/pages/:menu/:id(.:format) pages#update {:my_locale=>"ms"}
PATCH /mt/pages/:menu/:id(.:format) pages#update {:my_locale=>"mt"}
PATCH /mua/pages/:menu/:id(.:format) pages#update {:my_locale=>"mua"}
PATCH /my/pages/:menu/:id(.:format) pages#update {:my_locale=>"my"}
PATCH /naq/pages/:menu/:id(.:format) pages#update {:my_locale=>"naq"}
PATCH /nb/pages/:menu/:id(.:format) pages#update {:my_locale=>"nb"}
PATCH /nd/pages/:menu/:id(.:format) pages#update {:my_locale=>"nd"}
PATCH /nds/pages/:menu/:id(.:format) pages#update {:my_locale=>"nds"}
PATCH /ne/pages/:menu/:id(.:format) pages#update {:my_locale=>"ne"}
PATCH /nl/pages/:menu/:id(.:format) pages#update {:my_locale=>"nl"}
PATCH /nmg/pages/:menu/:id(.:format) pages#update {:my_locale=>"nmg"}
PATCH /nn/pages/:menu/:id(.:format) pages#update {:my_locale=>"nn"}
PATCH /nr/pages/:menu/:id(.:format) pages#update {:my_locale=>"nr"}
PATCH /nso/pages/:menu/:id(.:format) pages#update {:my_locale=>"nso"}
PATCH /nus/pages/:menu/:id(.:format) pages#update {:my_locale=>"nus"}
PATCH /nyn/pages/:menu/:id(.:format) pages#update {:my_locale=>"nyn"}
PATCH /oc/pages/:menu/:id(.:format) pages#update {:my_locale=>"oc"}
PATCH /om/pages/:menu/:id(.:format) pages#update {:my_locale=>"om"}
PATCH /or/pages/:menu/:id(.:format) pages#update {:my_locale=>"or"}
PATCH /pa/pages/:menu/:id(.:format) pages#update {:my_locale=>"pa"}
PATCH /ps/pages/:menu/:id(.:format) pages#update {:my_locale=>"ps"}
PATCH /pt/pages/:menu/:id(.:format) pages#update {:my_locale=>"pt"}
PATCH /rm/pages/:menu/:id(.:format) pages#update {:my_locale=>"rm"}
PATCH /rn/pages/:menu/:id(.:format) pages#update {:my_locale=>"rn"}
PATCH /ro/pages/:menu/:id(.:format) pages#update {:my_locale=>"ro"}
PATCH /rof/pages/:menu/:id(.:format) pages#update {:my_locale=>"rof"}
PATCH /rw/pages/:menu/:id(.:format) pages#update {:my_locale=>"rw"}
PATCH /rwk/pages/:menu/:id(.:format) pages#update {:my_locale=>"rwk"}
PATCH /sah/pages/:menu/:id(.:format) pages#update {:my_locale=>"sah"}
PATCH /saq/pages/:menu/:id(.:format) pages#update {:my_locale=>"saq"}
PATCH /sbp/pages/:menu/:id(.:format) pages#update {:my_locale=>"sbp"}
PATCH /se/pages/:menu/:id(.:format) pages#update {:my_locale=>"se"}
PATCH /seh/pages/:menu/:id(.:format) pages#update {:my_locale=>"seh"}
PATCH /ses/pages/:menu/:id(.:format) pages#update {:my_locale=>"ses"}
PATCH /sg/pages/:menu/:id(.:format) pages#update {:my_locale=>"sg"}
PATCH /shi/pages/:menu/:id(.:format) pages#update {:my_locale=>"shi"}
PATCH /si/pages/:menu/:id(.:format) pages#update {:my_locale=>"si"}
PATCH /sid/pages/:menu/:id(.:format) pages#update {:my_locale=>"sid"}
PATCH /sk/pages/:menu/:id(.:format) pages#update {:my_locale=>"sk"}
PATCH /sl/pages/:menu/:id(.:format) pages#update {:my_locale=>"sl"}
PATCH /sn/pages/:menu/:id(.:format) pages#update {:my_locale=>"sn"}
PATCH /so/pages/:menu/:id(.:format) pages#update {:my_locale=>"so"}
PATCH /sq/pages/:menu/:id(.:format) pages#update {:my_locale=>"sq"}
PATCH /sr/pages/:menu/:id(.:format) pages#update {:my_locale=>"sr"}
PATCH /ss/pages/:menu/:id(.:format) pages#update {:my_locale=>"ss"}
PATCH /ssy/pages/:menu/:id(.:format) pages#update {:my_locale=>"ssy"}
PATCH /st/pages/:menu/:id(.:format) pages#update {:my_locale=>"st"}
PATCH /sv/pages/:menu/:id(.:format) pages#update {:my_locale=>"sv"}
PATCH /sw/pages/:menu/:id(.:format) pages#update {:my_locale=>"sw"}
PATCH /swc/pages/:menu/:id(.:format) pages#update {:my_locale=>"swc"}
PATCH /ta/pages/:menu/:id(.:format) pages#update {:my_locale=>"ta"}
PATCH /te/pages/:menu/:id(.:format) pages#update {:my_locale=>"te"}
PATCH /teo/pages/:menu/:id(.:format) pages#update {:my_locale=>"teo"}
PATCH /tg/pages/:menu/:id(.:format) pages#update {:my_locale=>"tg"}
PATCH /th/pages/:menu/:id(.:format) pages#update {:my_locale=>"th"}
PATCH /ti/pages/:menu/:id(.:format) pages#update {:my_locale=>"ti"}
PATCH /tig/pages/:menu/:id(.:format) pages#update {:my_locale=>"tig"}
PATCH /tn/pages/:menu/:id(.:format) pages#update {:my_locale=>"tn"}
PATCH /to/pages/:menu/:id(.:format) pages#update {:my_locale=>"to"}
PATCH /tr/pages/:menu/:id(.:format) pages#update {:my_locale=>"tr"}
PATCH /trv/pages/:menu/:id(.:format) pages#update {:my_locale=>"trv"}
PATCH /ts/pages/:menu/:id(.:format) pages#update {:my_locale=>"ts"}
PATCH /twq/pages/:menu/:id(.:format) pages#update {:my_locale=>"twq"}
PATCH /tzm/pages/:menu/:id(.:format) pages#update {:my_locale=>"tzm"}
PATCH /uk/pages/:menu/:id(.:format) pages#update {:my_locale=>"uk"}
PATCH /ur/pages/:menu/:id(.:format) pages#update {:my_locale=>"ur"}
PATCH /uz/pages/:menu/:id(.:format) pages#update {:my_locale=>"uz"}
PATCH /vai/pages/:menu/:id(.:format) pages#update {:my_locale=>"vai"}
PATCH /ve/pages/:menu/:id(.:format) pages#update {:my_locale=>"ve"}
PATCH /vi/pages/:menu/:id(.:format) pages#update {:my_locale=>"vi"}
PATCH /vun/pages/:menu/:id(.:format) pages#update {:my_locale=>"vun"}
PATCH /wae/pages/:menu/:id(.:format) pages#update {:my_locale=>"wae"}
PATCH /wal/pages/:menu/:id(.:format) pages#update {:my_locale=>"wal"}
PATCH /xh/pages/:menu/:id(.:format) pages#update {:my_locale=>"xh"}
PATCH /xog/pages/:menu/:id(.:format) pages#update {:my_locale=>"xog"}
PATCH /yav/pages/:menu/:id(.:format) pages#update {:my_locale=>"yav"}
PATCH /yo/pages/:menu/:id(.:format) pages#update {:my_locale=>"yo"}
PATCH /zh/pages/:menu/:id(.:format) pages#update {:my_locale=>"zh"}
PATCH /zu/pages/:menu/:id(.:format) pages#update {:my_locale=>"zu"}
PUT /strony/:menu/:id(.:format) pages#update {:my_locale=>"pl"}
PUT /en/pages/:menu/:id(.:format) pages#update {:my_locale=>"en"}
PUT /de/pages/:menu/:id(.:format) pages#update {:my_locale=>"de"}
PUT /es-ar/pages/:menu/:id(.:format) pages#update {:my_locale=>"es-AR"}
PUT /es/pages/:menu/:id(.:format) pages#update {:my_locale=>"es"}
PUT /fr/pages/:menu/:id(.:format) pages#update {:my_locale=>"fr"}
PUT /it/pages/:menu/:id(.:format) pages#update {:my_locale=>"it"}
PUT /pt-br/pages/:menu/:id(.:format) pages#update {:my_locale=>"pt-BR"}
PUT /ru/pages/:menu/:id(.:format) pages#update {:my_locale=>"ru"}
PUT /aa/pages/:menu/:id(.:format) pages#update {:my_locale=>"aa"}
PUT /af/pages/:menu/:id(.:format) pages#update {:my_locale=>"af"}
PUT /agq/pages/:menu/:id(.:format) pages#update {:my_locale=>"agq"}
PUT /ak/pages/:menu/:id(.:format) pages#update {:my_locale=>"ak"}
PUT /am/pages/:menu/:id(.:format) pages#update {:my_locale=>"am"}
PUT /ar/pages/:menu/:id(.:format) pages#update {:my_locale=>"ar"}
PUT /as/pages/:menu/:id(.:format) pages#update {:my_locale=>"as"}
PUT /asa/pages/:menu/:id(.:format) pages#update {:my_locale=>"asa"}
PUT /az/pages/:menu/:id(.:format) pages#update {:my_locale=>"az"}
PUT /bas/pages/:menu/:id(.:format) pages#update {:my_locale=>"bas"}
PUT /be/pages/:menu/:id(.:format) pages#update {:my_locale=>"be"}
PUT /bem/pages/:menu/:id(.:format) pages#update {:my_locale=>"bem"}
PUT /bez/pages/:menu/:id(.:format) pages#update {:my_locale=>"bez"}
PUT /bg/pages/:menu/:id(.:format) pages#update {:my_locale=>"bg"}
PUT /bm/pages/:menu/:id(.:format) pages#update {:my_locale=>"bm"}
PUT /bn/pages/:menu/:id(.:format) pages#update {:my_locale=>"bn"}
PUT /bo/pages/:menu/:id(.:format) pages#update {:my_locale=>"bo"}
PUT /br/pages/:menu/:id(.:format) pages#update {:my_locale=>"br"}
PUT /brx/pages/:menu/:id(.:format) pages#update {:my_locale=>"brx"}
PUT /bs/pages/:menu/:id(.:format) pages#update {:my_locale=>"bs"}
PUT /byn/pages/:menu/:id(.:format) pages#update {:my_locale=>"byn"}
PUT /ca/pages/:menu/:id(.:format) pages#update {:my_locale=>"ca"}
PUT /cch/pages/:menu/:id(.:format) pages#update {:my_locale=>"cch"}
PUT /cgg/pages/:menu/:id(.:format) pages#update {:my_locale=>"cgg"}
PUT /chr/pages/:menu/:id(.:format) pages#update {:my_locale=>"chr"}
PUT /cs/pages/:menu/:id(.:format) pages#update {:my_locale=>"cs"}
PUT /cy/pages/:menu/:id(.:format) pages#update {:my_locale=>"cy"}
PUT /da/pages/:menu/:id(.:format) pages#update {:my_locale=>"da"}
PUT /dav/pages/:menu/:id(.:format) pages#update {:my_locale=>"dav"}
PUT /dje/pages/:menu/:id(.:format) pages#update {:my_locale=>"dje"}
PUT /dua/pages/:menu/:id(.:format) pages#update {:my_locale=>"dua"}
PUT /dyo/pages/:menu/:id(.:format) pages#update {:my_locale=>"dyo"}
PUT /dz/pages/:menu/:id(.:format) pages#update {:my_locale=>"dz"}
PUT /ebu/pages/:menu/:id(.:format) pages#update {:my_locale=>"ebu"}
PUT /ee/pages/:menu/:id(.:format) pages#update {:my_locale=>"ee"}
PUT /el/pages/:menu/:id(.:format) pages#update {:my_locale=>"el"}
PUT /eo/pages/:menu/:id(.:format) pages#update {:my_locale=>"eo"}
PUT /et/pages/:menu/:id(.:format) pages#update {:my_locale=>"et"}
PUT /eu/pages/:menu/:id(.:format) pages#update {:my_locale=>"eu"}
PUT /ewo/pages/:menu/:id(.:format) pages#update {:my_locale=>"ewo"}
PUT /fa/pages/:menu/:id(.:format) pages#update {:my_locale=>"fa"}
PUT /ff/pages/:menu/:id(.:format) pages#update {:my_locale=>"ff"}
PUT /fi/pages/:menu/:id(.:format) pages#update {:my_locale=>"fi"}
PUT /fil/pages/:menu/:id(.:format) pages#update {:my_locale=>"fil"}
PUT /fo/pages/:menu/:id(.:format) pages#update {:my_locale=>"fo"}
PUT /fr-ca/pages/:menu/:id(.:format) pages#update {:my_locale=>"fr-CA"}
PUT /fur/pages/:menu/:id(.:format) pages#update {:my_locale=>"fur"}
PUT /ga/pages/:menu/:id(.:format) pages#update {:my_locale=>"ga"}
PUT /gaa/pages/:menu/:id(.:format) pages#update {:my_locale=>"gaa"}
PUT /gd/pages/:menu/:id(.:format) pages#update {:my_locale=>"gd"}
PUT /gl/pages/:menu/:id(.:format) pages#update {:my_locale=>"gl"}
PUT /gsw/pages/:menu/:id(.:format) pages#update {:my_locale=>"gsw"}
PUT /gu/pages/:menu/:id(.:format) pages#update {:my_locale=>"gu"}
PUT /guz/pages/:menu/:id(.:format) pages#update {:my_locale=>"guz"}
PUT /gv/pages/:menu/:id(.:format) pages#update {:my_locale=>"gv"}
PUT /ha/pages/:menu/:id(.:format) pages#update {:my_locale=>"ha"}
PUT /haw/pages/:menu/:id(.:format) pages#update {:my_locale=>"haw"}
PUT /he/pages/:menu/:id(.:format) pages#update {:my_locale=>"he"}
PUT /hi/pages/:menu/:id(.:format) pages#update {:my_locale=>"hi"}
PUT /hr/pages/:menu/:id(.:format) pages#update {:my_locale=>"hr"}
PUT /hu/pages/:menu/:id(.:format) pages#update {:my_locale=>"hu"}
PUT /hy/pages/:menu/:id(.:format) pages#update {:my_locale=>"hy"}
PUT /ia/pages/:menu/:id(.:format) pages#update {:my_locale=>"ia"}
PUT /id/pages/:menu/:id(.:format) pages#update {:my_locale=>"id"}
PUT /ig/pages/:menu/:id(.:format) pages#update {:my_locale=>"ig"}
PUT /ii/pages/:menu/:id(.:format) pages#update {:my_locale=>"ii"}
PUT /is/pages/:menu/:id(.:format) pages#update {:my_locale=>"is"}
PUT /ja/pages/:menu/:id(.:format) pages#update {:my_locale=>"ja"}
PUT /jmc/pages/:menu/:id(.:format) pages#update {:my_locale=>"jmc"}
PUT /ka/pages/:menu/:id(.:f

bug with url_for

I try to use Kaminari pagination with rel_next_prev_link_tags helper.
But I've a routing error "No route matches {:page=>2, :locale=>nil, :controller=>"properties"}"
See https://github.com/amatsuda/kaminari/blob/master/lib/kaminari/helpers/action_view_extension.rb

This bug appear when url_for(params.merge) is used... and it works when I overwrite with

<link rel="next" href="<%= properties_path(Kaminari.config.param_name => (@properties.current_page + 1)) %> '"/>

Thanks for your help

Cannot setup

/ruby-1.9.2-p320/gems/actionpack-3.0.14/lib/action_dispatch/routing/route.rb:25:in `initialize': can't convert Array into String (TypeError)

config/locales/routes.yml

cs:
cars: 'translated_cars'

routes.rb
end
Dt::Application.routes.translate_from_file('config/locales/routes.yml')

Failing tests on v3.2.0

I just updated to 3.2.0, after this update every test in Rails engine fails. Older 3.1.0 works fine.

  4) Failure:
Blog::PostsController#test_0009_should destroy post [/Users/jirikolarik/Documents/Ruby/private-engines/blog/test/controllers/blog/posts_controller_test.rb:90]:
Expected response to be a redirect to <http://test.host/assets?controller=blog%2Fposts&locale=en> but was a redirect to <http://test.host/blog/posts>.
Expected "http://test.host/assets?controller=blog%2Fposts&locale=en" to be === "http://test.host/blog/posts".

undefined method `url_options' using Puma on Heroku

I was using Unicorn for a while without issues and decided to switch to Puma to take advantage of IO threading. I couldn't reproduce this on my development environment.
Here's the stacktrace from New Relic Using Puma on Heroku in production.
I have a hunch it might have something to do with threads... not sure though.

I reverted back to using Unicorn for now.

ActionView::Template::Error: undefined method `url_options' for #Module:0x007ff9fc345230
…ionpack-4.2.0/lib/action_dispatch/routing/route_set.rb: 271:in `call'
…ionpack-4.2.0/lib/action_dispatch/routing/route_set.rb: 334:in `block (2 levels) in define_url_helper'
…te_translator-4.0.0/lib/route_translator/translator.rb:  30:in `block (2 levels) in add_untranslated_helpers_to_controllers_and_views'
                 /app/app/helpers/
application_helper.rb: 169:in `event_path'
/app/app/views/app/shared/_content_event.html.haml:3:in `_app_views_app_shared__content_event_html_haml___3287174521702908540_70355826885860'
….2.0/gems/actionview-4.2.0/lib/action_view/template.rb: 145:in `block in render'
…ctivesupport-4.2.0/lib/active_support/notifications.rb: 164:in `block in instrument'
…4.2.0/lib/active_support/notifications/instrumenter.rb:  20:in `instrument'
…ctivesupport-4.2.0/lib/active_support/notifications.rb: 164:in `instrument'
….2.0/gems/actionview-4.2.0/lib/action_view/template.rb: 333:in `instrument'
….2.0/gems/actionview-4.2.0/lib/action_view/template.rb: 143:in `render'
…iew-4.2.0/lib/action_view/renderer/partial_renderer.rb: 339:in `render_partial'
…iew-4.2.0/lib/action_view/renderer/partial_renderer.rb: 310:in `block in render'
…ew-4.2.0/lib/action_view/renderer/abstract_renderer.rb:  39:in `block in instrument'
…ctivesupport-4.2.0/lib/active_support/notifications.rb: 164:in `block in instrument'
…4.2.0/lib/active_support/notifications/instrumenter.rb:  20:in `instrument'
…ctivesupport-4.2.0/lib/active_support/notifications.rb: 164:in `instrument'
…ew-4.2.0/lib/action_view/renderer/abstract_renderer.rb:  39:in `instrument'
…iew-4.2.0/lib/action_view/renderer/partial_renderer.rb: 309:in `render'
…/actionview-4.2.0/lib/action_view/renderer/renderer.rb:  47:in `render_partial'
…view-4.2.0/lib/action_view/helpers/rendering_helper.rb:  35:in `render'
…0/gems/haml-4.0.6/lib/haml/helpers/action_view_mods.rb:  10:in `block in render_with_haml'
…/bundle/ruby/2.2.0/gems/haml-4.0.6/lib/haml/helpers.rb:  89:in `non_haml'
…0/gems/haml-4.0.6/lib/haml/helpers/action_view_mods.rb:  10:in `render_with_haml'
/app/app/views/app/events/home.html.haml:7:in `block (3 levels) in _app_views_app_events_home_html_haml__1023603194467757244_70355867632540'
/app/app/views/app/events/home.html.haml:6:in `each'
/app/app/views/app/events/home.html.haml:6:in `each_with_index'
/app/app/views/app/events/home.html.haml:6:in `block (2 levels) in _app_views_app_events_home_html_haml__1023603194467757244_70355867632540'
…/ruby/2.2.0/gems/draper-1.4.0/lib/draper/delegation.rb:  10:in `each'
…/ruby/2.2.0/gems/draper-1.4.0/lib/draper/delegation.rb:  10:in `each_with_index'
…/ruby/2.2.0/gems/draper-1.4.0/lib/draper/delegation.rb:  10:in `each_with_index'
/app/app/views/app/events/home.html.haml:3:in `block in _app_views_app_events_home_html_haml__1023603194467757244_70355867632540'
…tionview-4.2.0/lib/action_view/helpers/cache_helper.rb: 190:in `write_fragment_for'
…tionview-4.2.0/lib/action_view/helpers/cache_helper.rb: 179:in `fragment_for'
…tionview-4.2.0/lib/action_view/helpers/cache_helper.rb: 115:in `cache'
             /app/lib/core_ext/
fragment_cache_helper.rb:  19:in `fragment_cache'
/app/app/views/app/events/home.html.haml:2:in `_app_views_app_events_home_html_haml__1023603194467757244_70355867632540'
….2.0/gems/actionview-4.2.0/lib/action_view/template.rb: 145:in `block in render'
…ctivesupport-4.2.0/lib/active_support/notifications.rb: 164:in `block in instrument'
…4.2.0/lib/active_support/notifications/instrumenter.rb:  20:in `instrument'
…ctivesupport-4.2.0/lib/active_support/notifications.rb: 164:in `instrument'
….2.0/gems/actionview-4.2.0/lib/action_view/template.rb: 333:in `instrument'
….2.0/gems/actionview-4.2.0/lib/action_view/template.rb: 143:in `render'
…ew-4.2.0/lib/action_view/renderer/template_renderer.rb:  54:in `block (2 levels) in render_template'
…ew-4.2.0/lib/action_view/renderer/abstract_renderer.rb:  39:in `block in instrument'
…ctivesupport-4.2.0/lib/active_support/notifications.rb: 164:in `block in instrument'
…4.2.0/lib/active_support/notifications/instrumenter.rb:  20:in `instrument'
…ctivesupport-4.2.0/lib/active_support/notifications.rb: 164:in `instrument'
…ew-4.2.0/lib/action_view/renderer/abstract_renderer.rb:  39:in `instrument'
…ew-4.2.0/lib/action_view/renderer/template_renderer.rb:  53:in `block in render_template'
…ew-4.2.0/lib/action_view/renderer/template_renderer.rb:  61:in `render_with_layout'
…ew-4.2.0/lib/action_view/renderer/template_renderer.rb:  52:in `render_template'
…ew-4.2.0/lib/action_view/renderer/template_renderer.rb:  14:in `render'
…/actionview-4.2.0/lib/action_view/renderer/renderer.rb:  42:in `render_template'
…/actionview-4.2.0/lib/action_view/renderer/renderer.rb:  23:in `render'
…2.0/gems/actionview-4.2.0/lib/action_view/rendering.rb: 100:in `_render_template'
…ionpack-4.2.0/lib/action_controller/metal/streaming.rb: 217:in `_render_template'
…2.0/gems/actionview-4.2.0/lib/action_view/rendering.rb:  83:in `render_to_body'
…ionpack-4.2.0/lib/action_controller/metal/rendering.rb:  32:in `render_to_body'
…ionpack-4.2.0/lib/action_controller/metal/renderers.rb:  37:in `render_to_body'
…/actionpack-4.2.0/lib/abstract_controller/rendering.rb:  25:in `render'
…ionpack-4.2.0/lib/action_controller/metal/rendering.rb:  16:in `render'
…k-4.2.0/lib/action_controller/metal/instrumentation.rb:  41:in `block (2 levels) in render'
…support-4.2.0/lib/active_support/core_ext/benchmark.rb:  12:in `block in ms'
     /app/vendor/ruby-2.2.0/lib/ruby/2.2.0/
benchmark.rb: 303:in `realtime'
…support-4.2.0/lib/active_support/core_ext/benchmark.rb:  12:in `ms'
…k-4.2.0/lib/action_controller/metal/instrumentation.rb:  41:in `block in render'
…k-4.2.0/lib/action_controller/metal/instrumentation.rb:  84:in `cleanup_view_runtime'
…/2.2.0/gems/searchkick-0.8.5/lib/searchkick/logging.rb: 112:in `cleanup_view_runtime'
…4.2.0/lib/active_record/railties/controller_runtime.rb:  25:in `cleanup_view_runtime'
…k-4.2.0/lib/action_controller/metal/instrumentation.rb:  40:in `render'
         /app/app/controllers/concerns/
before_render.rb:  11:in `block in render_with_before_render_action'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 117:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 117:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 190:in `block in simple'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb:  92:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb:  92:in `_run_callbacks'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 734:in `_run_render_callbacks'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb:  81:in `run_callbacks'
         /app/app/controllers/concerns/
before_render.rb:  10:in `render_with_before_render_action'
…ack-4.2.0/lib/action_controller/metal/mime_responds.rb: 216:in `respond_to'
          /app/app/controllers/app/
events_controller.rb:  36:in `home'
…k-4.2.0/lib/action_controller/metal/implicit_render.rb:   4:in `send_action'
…/gems/actionpack-4.2.0/lib/abstract_controller/base.rb: 198:in `process_action'
…ionpack-4.2.0/lib/action_controller/metal/rendering.rb:  10:in `process_action'
…/actionpack-4.2.0/lib/abstract_controller/callbacks.rb:  20:in `block in process_action'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 117:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 117:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 151:in `block in halting_and_conditional'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 151:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 151:in `block in halting_and_conditional'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 151:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 151:in `block in halting_and_conditional'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 151:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 151:in `block in halting_and_conditional'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `block in halting'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `block in halting'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 234:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 234:in `block in halting'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `block in halting'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `block in halting'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `block in halting'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `block in halting'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `block in halting'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 234:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 234:in `block in halting'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `block in halting'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `block in halting'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `block in halting'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 308:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 308:in `block (2 levels) in halting'
…0/lib/route_translator/extensions/action_controller.rb:  20:in `set_locale_from_url'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 427:in `block in make_lambda'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 307:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 307:in `block in halting'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 151:in `call'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 151:in `block in halting_and_conditional'
…ms/activesupport-4.2.0/lib/active_support/callbacks.rb: 169:in `call'

params in url worked in 2.0.1 but not any more in 3.0.1

hi,
with route_translator 2.0.1, I had route.rb like this
get 'products_path', :controller => 'products', :action => 'index', :constraints => { :city_id => /\d+/, :category_id => /\d+/, :user_id => /\d+/, :subcategory_id => /\d+/, :prefixid => /[A-Z]{3}/}, :as => :products

and in my i18n-routes.yml
fr:
products_path: "(:userslug(-:user_id)/)articles(/:categoryslug-:rubrique_id(/:subcategoryslug-:subcategory_id))(/:cityslug-_:city_id)(/:productslug-:prefixid:id)(/:action)"

en:
products_path: "(:userslug(-:user_id)/)products(/:categoryslug-:rubrique_id(/:subcategoryslug-:subcategory_id))(/:cityslug-_:city_id)(/:productslug-:prefixid:id)(/:action)"

and it was working perfectly
but since I updated to 3.0.1 , I have this error and I can't figure why

NoMethodError (undefined method city_id' for #<ActionDispatch::Request:0x000000072515a0>): journey (1.0.4) lib/journey/router.rb:133:inblock (2 levels) in find_routes'
journey (1.0.4) lib/journey/router.rb:133:in each' journey (1.0.4) lib/journey/router.rb:133:inall?'
journey (1.0.4) lib/journey/router.rb:133:in block in find_routes' journey (1.0.4) lib/journey/router.rb:132:ineach'
journey (1.0.4) lib/journey/router.rb:132:in find_all' journey (1.0.4) lib/journey/router.rb:132:infind_routes'
journey (1.0.4) lib/journey/router.rb:56:in call' actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:612:incall'
newrelic_rpm (3.6.1.88) lib/new_relic/rack/error_collector.rb:12:in call' newrelic_rpm (3.6.1.88) lib/new_relic/rack/agent_hooks.rb:18:incall'
newrelic_rpm (3.6.1.88) lib/new_relic/rack/browser_monitoring.rb:16:in call' warden (1.2.1) lib/warden/manager.rb:35:inblock in call'
warden (1.2.1) lib/warden/manager.rb:34:in catch' warden (1.2.1) lib/warden/manager.rb:34:incall'
actionpack (3.2.13) lib/action_dispatch/middleware/best_standards_support.rb:17:in call' rack (1.4.5) lib/rack/etag.rb:23:incall'
rack (1.4.5) lib/rack/conditionalget.rb:25:in call' actionpack (3.2.13) lib/action_dispatch/middleware/head.rb:14:incall'
actionpack (3.2.13) lib/action_dispatch/middleware/params_parser.rb:21:in call' actionpack (3.2.13) lib/action_dispatch/middleware/flash.rb:242:incall'
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in context' rack (1.4.5) lib/rack/session/abstract/id.rb:205:incall'
actionpack (3.2.13) lib/action_dispatch/middleware/cookies.rb:341:in call' activerecord (3.2.13) lib/active_record/query_cache.rb:64:incall'
activerecord (3.2.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in call' actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:28:inblock in call'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in _run__2146773877232852005__call__139502699737427917__callbacks' activesupport (3.2.13) lib/active_support/callbacks.rb:405:in__run_callback'
activesupport (3.2.13) lib/active_support/callbacks.rb:385:in _run_call_callbacks' activesupport (3.2.13) lib/active_support/callbacks.rb:81:inrun_callbacks'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:27:in call' actionpack (3.2.13) lib/action_dispatch/middleware/remote_ip.rb:31:incall'
actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:16:in call' actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:incall'
railties (3.2.13) lib/rails/rack/logger.rb:32:in call_app' railties (3.2.13) lib/rails/rack/logger.rb:16:inblock in call'
activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in tagged' railties (3.2.13) lib/rails/rack/logger.rb:16:incall'
actionpack (3.2.13) lib/action_dispatch/middleware/request_id.rb:22:in call' rack (1.4.5) lib/rack/methodoverride.rb:21:incall'
rack (1.4.5) lib/rack/runtime.rb:17:in call' activesupport (3.2.13) lib/active_support/cache/strategy/local_cache.rb:72:incall'
rack (1.4.5) lib/rack/lock.rb:15:in call' actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:incall'
rack-cache (1.2) lib/rack/cache/context.rb:136:in forward' rack-cache (1.2) lib/rack/cache/context.rb:245:infetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in lookup' rack-cache (1.2) lib/rack/cache/context.rb:66:incall!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in call' railties (3.2.13) lib/rails/engine.rb:479:incall'
railties (3.2.13) lib/rails/application.rb:223:in call' railties (3.2.13) lib/rails/railtie/configurable.rb:30:inmethod_missing'
unicorn (4.6.2) lib/unicorn/http_server.rb:552:in process_client' unicorn (4.6.2) lib/unicorn/http_server.rb:632:inworker_loop'
newrelic_rpm (3.6.1.88) lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb:22:in call' newrelic_rpm (3.6.1.88) lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb:22:inblock (4 levels) in <top (required)>'
unicorn (4.6.2) lib/unicorn/http_server.rb:500:in spawn_missing_workers' unicorn (4.6.2) lib/unicorn/http_server.rb:142:instart'
unicorn (4.6.2) bin/unicorn:126:in <top (required)>' /home/railsskelbimai/.rvm/gems/ruby-1.9.3-p392/bin/unicorn:19:inload'
/home/railsskelbimai/.rvm/gems/ruby-1.9.3-p392/bin/unicorn:19:in <main>' /home/railsskelbimai/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:ineval'
/home/railsskelbimai/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `

'

isnt it possible anymore to have params in url ?

thanks

Advice for Rspec

Thanks for this gem. It's awesome.

After setting things up with the defaults, all of my controller and route specs exploded. The errors produced all have to do with the routes not being found.

Does anyone have any advice on this? I've seen some posts on SO about monkey patching here and there, but those approaches don't seem to be working out for me.

Note that setting:

RouteTranslator.config do |config|
  config.generate_unlocalized_routes = true
end

solves this issue. However, when I do this the urls generated fallback to the default locale. For example, my routes file is something like:

localized do
    resources :cars, only: [:index, :show]
end

and my link would be something along the lines of:

= link_to car.make, car

In this situation, visiting /fr/voitures should have produced the french routes, such as /fr/voitures/toyota but they fall back to /cars/toyota. This was unexpected behaviour. I thought it would have generated the french url in this situation given the french scoping and fall back only when necessary. This behaviour does not occur when the config setting is false. Having the gem generate the unlocalized routes but not fall back immediately when generating the urls would solve everything for me.

Any advice is appreciated. Thanks!

How to conditionally use route translator

Hello all!

I work with RefineryCMS (https://github.com/refinery/refinerycms) and i would like to use your gem in order to translate some refinerycms routes, see my PR on this project :
refinery/refinerycms-i18n#51

Is there another way to use conditionally localized method than :

if defined? localized 
  localized do
    routes
  end
else
  routes
end

I do this because for some english countries, they doesn't want to load localized routes if they doesn't use refinerycms-i18n.

default_locale is ignored

i have a problem with my routes, when default_locale is :pl i want my route to be example.com/posty, instead i get example.com/pl/posty.

How do I test routes?

Whenever I declare my routes adding localization

  localized do
    resources :municipios
  end

my generated controller tests all fail

  1) Error:
test_should_get_index(MunicipiosControllerTest):
ActionController::RoutingError: No route matches {:controller=>"municipios"}
    /home/rachel/.rvm/gems/ruby-1.9.3-p429/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:544:in `raise_routing_error'
    /home/rachel/.rvm/gems/ruby-1.9.3-p429/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:540:in `rescue in generate'
    /home/rachel/.rvm/gems/ruby-1.9.3-p429/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:532:in `generate'
    /home/rachel/.rvm/gems/ruby-1.9.3-p429/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:573:in `generate'
    /home/rachel/.rvm/gems/ruby-1.9.3-p429/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:569:in `generate_extras'
    /home/rachel/.rvm/gems/ruby-1.9.3-p429/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:565:in `extra_keys'
    /home/rachel/.rvm/gems/ruby-1.9.3-p429/gems/actionpack-3.2.13/lib/action_controller/test_case.rb:153:in `assign_parameters'
    /home/rachel/.rvm/gems/ruby-1.9.3-p429/gems/actionpack-3.2.13/lib/action_controller/test_case.rb:465:in `process'
    /home/rachel/.rvm/gems/ruby-1.9.3-p429/gems/actionpack-3.2.13/lib/action_controller/test_case.rb:49:in `process'
    /home/rachel/.rvm/gems/ruby-1.9.3-p429/gems/actionpack-3.2.13/lib/action_controller/test_case.rb:392:in `get'
    test/functional/municipios_controller_test.rb:9:in `block in <class:MunicipiosControllerTest>'

This happens even if I only use english as config.i18n.available_locales and config.i18n.default_locale. But whenever I remove the localized block, all tests pass.

Is there a way I can test those routes with get :action?

redirect to current local

Hi,

I have

  localized do
    get   'brands'              => 'pages#brands',              as: 'brands_page'
  end

I use the option

    config.generate_unnamed_unlocalized_routes = true

So /fr/marque or de/maken is okay

Any options to /brands redirect to fr/marque if I18n.locale is :fr ?

Sorry to post an issue for this..

Default locales

Where can I define my translated locales?
I only want to have one language, but I get :en, :es and :de locale routes.. I only want to have :de routes.

routes.rb

localized do
  resources :products, :only => [:index, :show]
end

config in initializer:

RouteTranslator.config do |config|
  config.hide_locale = true
end

translations:

de:
  routes:
    products: "produkte"

when I run

bundle exec rake routes

I get following output

products_en GET  /products(.:format)                       products#index {:locale =>"en"}
products_es GET  /products(.:format)                       products#index {:locale=>"es"}
products_de GET  /produkte.:format)                        products#index {:locale=>"de"}
product_en GET  /products/:id(.:format)                    products#show {:locale=>"en"}
product_es GET  /products/:id(.:format)                    products#show {:locale=>"es"}
product_de GET  /produkte/:id(.:format)                    products#show {:locale=>"de"}

shouldn´t it just be

products_de GET  /produkte.:format)                        products#index {:locale=>"de"}
product_de GET  /produkte/:id(.:format)                    products#show {:locale=>"de"}

Or do I misunderstood something?

collection routes is not working for me

In my routes.rb

I want only translate an action:

resources :houses, :only => [:all_users], :path => "" do
  collection do
    localized do
      get :all_users
    end
  end
end

For example, y my es.yml (Spanish):

es:
  routes:
    freecvs:
      resume_builder: "todos-los-usuarios"

However I can not see translated my route. These are my routes:

all_users_houses GET (/:locale)/all_users(.:format) houses#all_users
GET /es(/:locale)/all_users(.:format) houses#all_users{:locale=>"es"}
GET /en(/:locale)/all_users(.:format) houses#all_users{:locale=>"en"}

Where have I the error? What am I doing wrong?

Thanks!

Change locale

Hi, I'm using 2 locales in my app, pt and en. Where pt is the default.

I set config.force_locale = true, to my app for use:

http://localhost:3000/pt
http://localhost:3000/en
http://localhost:3000/pt/noticias
http://localhost:3000/en/news

Everything works fine.

But if I'm in http://localhost:3000/pt/noticias and I want to change directly to http://localhost:3000/en/news, how can I do that?

Today in the header of the pages I have:

<%= link_to 'Português', root_pt_path %>
<%= link_to 'English', root_en_path %>

But, of course it always redirect to the root of each locale.
Is there something that for it?

Using Rails 4

Thanks.

Error 406 in rails admin with IE

Hi,

I'm using route_translator in a project of mine.

I found a very bad issue with old IE versions (8 and maybe 9 but I'm not 100% sure) that unfortunately I still need to support.

When validations fail in rails admin, IE8 outputs the following error:

406railsadmin

Without route_translator, everything is fine

Steps to reproduce:

  1. Go to http://hidden-basin-9589.herokuapp.com/admin with IE8
  2. Login with [email protected] demodemo
  3. Click on Pages on the left navigation menu
  4. Click on Add new tab
  5. Click on Save

The source code of this application is available here: https://github.com/tagliala/rails-admin-406

I also tried to override the rails admin application controller and add skip_before_filter :set_locale_from_url without any luck

This bug doesn't appear in development environment

We are using the master branch of route_translator

Please let me know if you think you know the source of this problem

Thanks In Advance

Routes inside scopes with conditional variables are not translated

I'v added a test to show the issue:
#33

With this i18n-routes.yml:

da:
  routes:
    foo: julemand
    too: nissepige

There is a problem with scopes that include conditional variables:

namespace :myspace do
  scope "/:user_id" do
    get 'foo' => 'foo#bar' # Is translated correctly
    # myspace_julemand_da GET  /da/myspace/:user_id/julemand(.:format)
  end
  scope "/(:user_id)" do
    get 'too' => 'too#bar' # Is not translated :(
    # myspace_too_da GET  /da/myspace(/:user_id)/too(.:format)
  end
end

Which surely must be a bug?

generate_unlocalized_routes generates duplicates

Setting route_translator.generate_unlocalized_routes = true creates duplicates of each route in each locale, e.g.

student_questions_en GET    /en/student/questions(.:format)    student/questions#index {:locale=>"en"}
student_questions_en GET    /en/student/questions(.:format)    student/questions#index {:locale=>"en"}
student_questions_de GET    /de/student/questions(.:format)    student/questions#index {:locale=>"de"}
student_questions_de GET    /de/student/questions(.:format)    student/questions#index {:locale=>"de"}
   student_questions GET    /student/questions(.:format)       student/questions#index
   student_questions GET    /student/questions(.:format)       student/questions#index

Translate whole path

It'd be great if it'd be possible to translate the whole path, not only individual segments.

Example:

resource :inquiry
=> /inquiry/new
=> /neue-beratungsanfrage

Issues with rails admin (Thread related)

Hi @enriclluelles,

we are using this gem together with rails_admin and we are experiencing a serious issue in production environment.

It seems that the locale "leaks" from the website request to rails admin.

We can provide an example:
Access to the admin area here: http://polar-plains-1091.herokuapp.com/admin

User: [email protected]
Pass: demo

You will see the rails admin interface in English

Then open http://polar-plains-1091.herokuapp.com/it and try to refresh both pages at the same time: rails admin will randomly show up in Italian

We are using puma and unicorn

The source code of this application is here: https://github.com/diowa/route_translator_rails_admin_issue

Any help would be appreciated

Extra information:

  • It also happens on rails 3.2.15
  • It also happens with Thin webserver

Problem with rspec and format parameter

Hello,

I am running into a weird problem when using your gem.

I have a controller spec, and I am writing a test like this:

      it "works" do
        post :create, locale: :en, format: :js
        expect(response).to be_success
      end

But I will get a ActionController::UrlGenerationError. If I leave the format parameter out, it will work however. The test will also work if I move the resource out of the localize block in the routes file. I was able to reproduce this with one test in a fork to make this easier to show what the issue is:

https://github.com/mkon/route_translator/commit/ad4f7adc11387c630894589dd20acba960574c64

Test will fail with

ActionController::UrlGenerationError: No route matches {:action=>"index", :controller=>"products", :format=>:json, :locale=>:es}
    /Users/konstantin/.rvm/gems/ruby-2.1.3/gems/actionpack-4.2.0.beta1/lib/action_dispatch/journey/formatter.rb:45:in `generate'
    /Users/konstantin/.rvm/gems/ruby-2.1.3/gems/actionpack-4.2.0.beta1/lib/action_dispatch/routing/route_set.rb:658:in `generate'
    /Users/konstantin/.rvm/gems/ruby-2.1.3/gems/actionpack-4.2.0.beta1/lib/action_dispatch/routing/route_set.rb:689:in `generate'
    /Users/konstantin/.rvm/gems/ruby-2.1.3/gems/actionpack-4.2.0.beta1/lib/action_dispatch/routing/route_set.rb:684:in `generate_extras'
    /Users/konstantin/.rvm/gems/ruby-2.1.3/gems/actionpack-4.2.0.beta1/lib/action_dispatch/routing/route_set.rb:679:in `extra_keys'
    /Users/konstantin/.rvm/gems/ruby-2.1.3/gems/actionpack-4.2.0.beta1/lib/action_controller/test_case.rb:204:in `assign_parameters'
    /Users/konstantin/.rvm/gems/ruby-2.1.3/gems/actionpack-4.2.0.beta1/lib/action_controller/test_case.rb:615:in `process'
    /Users/konstantin/.rvm/gems/ruby-2.1.3/gems/actionpack-4.2.0.beta1/lib/action_controller/test_case.rb:64:in `process'
    /Users/konstantin/.rvm/gems/ruby-2.1.3/gems/actionpack-4.2.0.beta1/lib/action_controller/test_case.rb:504:in `get'
    /Users/konstantin/Rails/Gems/route_translator/test/routing_test.rb:590:in `test_tests_can_find_routes_with_format'

Again if the format parameter is removed, the test will pass. The test will also fail if format: :html is used.

Duplicated locale on path

The following error ocurred in production, but it only happens sometimes, therefore I couldn't isolate the error and correct it:

A NoMethodError occurred in orders#new:

undefined method root_pt_pt_path' for #<OrdersController:0x00000007bca730> route_translator (2.0.0) lib/route_translator/route_set/translator.rb:66:inblock (3 levels) in add_untranslated_helpers_to_controllers_and_views'

route_translator (2.0.0) lib/route_translator/route_set/translator.rb:66:in block (3 levels) in add_untranslated_helpers_to_controllers_and_views' route_translator (2.0.0) lib/route_translator/route_set/translator.rb:64:inblock (3 levels) in add_untranslated_helpers_to_controllers_and_views'
app/controllers/application_controller.rb:48:in load_sections' activesupport (3.2.8) lib/active_support/callbacks.rb:429:in_run__1797966502979338638__process_action__4242015495659791559__callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in __run_callback' activesupport (3.2.8) lib/active_support/callbacks.rb:385:in_run_process_action_callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in run_callbacks' actionpack (3.2.8) lib/abstract_controller/callbacks.rb:17:inprocess_action'
actionpack (3.2.8) lib/action_controller/metal/rescue.rb:29:in process_action' actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:30:inblock in process_action'
activesupport (3.2.8) lib/active_support/notifications.rb:123:in block in instrument' activesupport (3.2.8) lib/active_support/notifications/instrumenter.rb:20:ininstrument'
activesupport (3.2.8) lib/active_support/notifications.rb:123:in instrument' actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:29:inprocess_action'
actionpack (3.2.8) lib/action_controller/metal/params_wrapper.rb:207:in process_action' activerecord (3.2.8) lib/active_record/railties/controller_runtime.rb:18:inprocess_action'
newrelic_rpm (3.5.4.34) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:34:in block in process_action' newrelic_rpm (3.5.4.34) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:268:inblock in perform_action_with_newrelic_trace'
newrelic_rpm (3.5.4.34) lib/new_relic/agent/method_tracer.rb:242:in trace_execution_scoped' newrelic_rpm (3.5.4.34) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:263:inperform_action_with_newrelic_trace'
newrelic_rpm (3.5.4.34) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:33:in process_action' actionpack (3.2.8) lib/abstract_controller/base.rb:121:inprocess'
actionpack (3.2.8) lib/abstract_controller/rendering.rb:45:in process' actionpack (3.2.8) lib/action_controller/metal.rb:203:indispatch'
actionpack (3.2.8) lib/action_controller/metal/rack_delegation.rb:14:in dispatch' actionpack (3.2.8) lib/action_controller/metal.rb:246:inblock in action'
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:73:in call' actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:73:indispatch'
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:36:in call' journey (1.0.4) lib/journey/router.rb:68:inblock in call'
journey (1.0.4) lib/journey/router.rb:56:in each' journey (1.0.4) lib/journey/router.rb:56:incall'
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:600:in call' newrelic_rpm (3.5.4.34) lib/new_relic/rack/error_collector.rb:8:incall'
newrelic_rpm (3.5.4.34) lib/new_relic/rack/browser_monitoring.rb:12:in call' sass (3.2.1) lib/sass/plugin/rack.rb:54:incall'
exception_notification (3.0.0) lib/exception_notifier.rb:40:in call' warden (1.2.1) lib/warden/manager.rb:35:inblock in call'
warden (1.2.1) lib/warden/manager.rb:34:in catch' warden (1.2.1) lib/warden/manager.rb:34:incall'
actionpack (3.2.8) lib/action_dispatch/middleware/best_standards_support.rb:17:in call' rack (1.4.1) lib/rack/etag.rb:23:incall'
rack (1.4.1) lib/rack/conditionalget.rb:25:in call' actionpack (3.2.8) lib/action_dispatch/middleware/head.rb:14:incall'
actionpack (3.2.8) lib/action_dispatch/middleware/params_parser.rb:21:in call' actionpack (3.2.8) lib/action_dispatch/middleware/flash.rb:242:incall'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in context' rack (1.4.1) lib/rack/session/abstract/id.rb:200:incall'
actionpack (3.2.8) lib/action_dispatch/middleware/cookies.rb:339:in call' activerecord (3.2.8) lib/active_record/query_cache.rb:64:incall'
activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in call' actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:28:inblock in call'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in _run__1699682167910864531__call__1468811000232310966__callbacks' activesupport (3.2.8) lib/active_support/callbacks.rb:405:in__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:385:in _run_call_callbacks' activesupport (3.2.8) lib/active_support/callbacks.rb:81:inrun_callbacks'
actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:27:in call' rack (1.4.1) lib/rack/sendfile.rb:102:incall'
actionpack (3.2.8) lib/action_dispatch/middleware/remote_ip.rb:31:in call' actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:16:incall'
actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in call' railties (3.2.8) lib/rails/rack/logger.rb:26:incall_app'
railties (3.2.8) lib/rails/rack/logger.rb:16:in call' actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:incall'
rack (1.4.1) lib/rack/methodoverride.rb:21:in call' rack (1.4.1) lib/rack/runtime.rb:17:incall'
activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:in call' rack (1.4.1) lib/rack/lock.rb:15:incall'
rack-cache (1.2) lib/rack/cache/context.rb:136:in forward' rack-cache (1.2) lib/rack/cache/context.rb:245:infetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in lookup' rack-cache (1.2) lib/rack/cache/context.rb:66:incall!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in call' railties (3.2.8) lib/rails/engine.rb:479:incall'
railties (3.2.8) lib/rails/application.rb:223:in call' railties (3.2.8) lib/rails/railtie/configurable.rb:30:inmethod_missing'
passenger (3.0.11) lib/phusion_passenger/rack/request_handler.rb:96:in process_request' passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:513:inaccept_and_process_next_request'
passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:274:in main_loop' passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:206:instart_request_handler'
passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:171:in block in handle_spawn_application' passenger (3.0.11) lib/phusion_passenger/utils.rb:479:insafe_fork'
passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:166:in handle_spawn_application' passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:inserver_main_loop'
passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:206:in start_synchronously' passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:180:instart'
passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:129:in start' passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:253:inblock (2 levels) in spawn_rack_application'
passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:132:in lookup_or_add' passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:246:inblock in spawn_rack_application'
passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:82:in block in synchronize' <internal:prelude>:10:insynchronize'
passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:79:in synchronize' passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:244:inspawn_rack_application'
passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:137:in spawn_application' passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:275:inhandle_spawn_application'
passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in server_main_loop' passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:206:instart_synchronously'
passenger (3.0.11) helper-scripts/passenger-spawn-server:99:in `

'

All locales must have translated routes for RAILS_ENV=production

Maybe this is not a bug in the code but maybe something to add to the README.

There are some differences between either routing or I18n in Rails' production and development environments that forced me to translate the routes for all locales. This is what happened.

I have two locales

config.i18n.default_locale = :it
I18n.available_locales = [:it, :en]

and

RouteTranslator.config do |config|
  config.hide_locale = true
end

routes.it.yml

it:
  routes:
    companies: "imprese"

I didn't have a routes.en.yml.

rake routes in development:

company_en GET      /companies/:id(.:format)  companies#show {:locale=>"en"}
company_it GET      /imprese/:id(.:format)    companies#show {:locale=>"it"}

rake routes in production:

company_en GET      /imprese/:id(.:format)      companies#show {:locale=>"en"}
company_it GET      /imprese/:id(.:format)      companies#show {:locale=>"it"}

The first one for production is the English route with the Italian translation and the en locale.
I was getting locale: "en" in every action called with Italian routes because probably the English route comes before the Italian one in Rails' routing code (because "en" < "it" ?). The same happened for all the other controllers with translated routes so I couldn't get Italian translations in my views.

I fixed that by adding routes.en.yml with

en:
  routes:
    companies: "companies"

Maybe without that file the gem gets the Italian translation as a default for the missing English one, instead of the untranslated route name. If this is the case, it could be fixed in the code. If not, well... this is the workaround.

How to get path for given locale?

Is it possible and how to do it?
I mean sth. like:
projects_path(locale: 'en')
Where:
project is the name of the controller
I18n.locale.to_s is different than 'en'

Testing controller

Hi,

I have the following controller spec

require 'spec_helper'

RSpec.describe ProfilesController, :type => :controller do
  describe "GET 'index'" do
    before do
      controller.stub(:authenticate_user!)
    end

    it "load all the profiles" do
      get :index

      expect(assigns(:profiles)).to eq Profile.all.order(:id)
    end
  end

  describe "PUT 'update'" do
    let(:profile) { profiles(:admin) }

    before do
      controller.stub(:authenticate_user!)
    end

    it "calls the ProfileUpdater service" do
      params = {"permission"=>"manage", "value"=>true, "id"=>"135138680",
                "controller"=>"profiles", "action"=>"update"}

      updater = double(:updater, status: 201)

      ProfileUpdater.should_receive(:new).with(params).and_return(updater)

      updater.should_receive(:update)

      put :update, params
    end
  end
end

and the following routes.rb

Rails.application.routes.draw do
  localized do
    resources :profiles
  end
end

When I run my controller spec I get the following error:

  1) ProfilesController GET 'index' load all the profiles
     Failure/Error: get :index
     ActionController::UrlGenerationError:
       No route matches {:action=>"index", :controller=>"profiles"}
     # ./spec/controllers/profiles_controller_spec.rb:17:in `block (3 levels) in <top (required)>'

  2) ProfilesController PUT 'update' calls the ProfileUpdater service
     Failure/Error: put :update, params
     ActionController::UrlGenerationError:
       No route matches {:action=>"update", :controller=>"profiles", :id=>"135138680", :permission=>"manage", :value=>true}
     # ./spec/controllers/profiles_controller_spec.rb:40:in `block (3 levels) in <top (required)>'

Someone can tell me why the spec doesn't recognise the routes anymore?

NoMethodError: undefined method `optimize_routes_generation?'

Hey.

Today I upgraded our Rails 4 (4.0.3, Ruby 2.1.0) application to use route_translator 3.2.0 instead of 3.1.0. Since upgrading a lot of our tests are failing (in some kind of a weird way). I'm seeing errors like this:

ActionMailer::TestCase#test_track_path:
NoMethodError: undefined method `optimize_routes_generation?' for #<ActionMailer::TestCase:0x007fedc9958cd8>

When I downgrade back to 3.1.0. everything works again.

I was able to find out what caused the error: Our routes file looks like this:

MyApp::Application.routes.draw do
  # Routing for localized outer content section
  localized do
    root to: 'index#index'
    get 'benefits' => 'index#benefits', as: :index_benefits
    get 'how-it-works' => 'index#how_it_works', as: :index_how_it_works
    get 'pricing' => 'index#pricing', as: :index_pricing
  end

  get   '/test/track'         => 'index#test_track', as: :test_track

  # A lot of more routes ....
end

When I rename the route for /test/track to e.g. :test_foo is still fails, when I rename it to :track_test e.g. the error disappears. So any route with a name starting with test causes this error.

I was not yet able to dig into the route_translator code or to build a proper failing test. Maybe anyone has already an idea what introduced this behaviour in version 3.2.0?

Change default locale dynamically

We have a single rails app hit by a danish and swedish domain. On our default danish site the routes are working as expected, as danish is the default locale - /resource/ for danish pages, /:locale/resource for the rest.
On the swedish site the urls to the swedish pages get prefixed with the locale which we would like to aviod, as swedish should be the default locale here.
So what we'll need is a method to change the default locale for the routes dynamically on each request, or it could be taken from I18n.default_locale when the url helpers are called.

I would like to donate $100 to the contributor who can help with this.
Thanks,
Soren

Not works with nginx with unicorn

It only didn't work with unicorn with nginx.

I have no idea.

nginx.conf

    location @automated_testing_framework {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://automated_testing_framework;
    }

Gemfile

gem 'route_translator'

routes.rb

  localized do

    namespace :tool do
      namespace :cvt do
        resources :video_info_tests do
          resources :video_info_logs
        end
      end
    end
 end

Application.rb

config.i18n.available_locales = ["zh-TW", :zh, :en, :jp]
config.i18n.default_locale = "zh-TW"

is it possible to deactivate not necessary routes ?

Hey thanks for this awesome gem ;)

Is it possible to deactivate not necessary routes.
Currently my app generate for every language the final routes. But i really need only 2 of them.

Thx for help

Best regards

Eric

can't convert Array into String

Hello,

i want to use this gem instead of "translate_routes" - my project rails 3.0.1.

  1. try:
    rake 0.8.7 routes
    returns:
    rake aborted!
    can't convert Array into String
  2. try:
    server start - same problem.

Is it possible, that routes like:
resources :informations, :only => [:index, :show] etc. throws this error?

thanks.

Why sometimes it doesn't generate unlocalized route helpers?

Following routes:

namespace :dashboard do
  resources :request_proposals, only: %w(show), path: :proposals do
    resource :order_review, path: :review
  end
end

Generate following URLs (among others):

new_dashboard_request_proposal_order_review_es GET    /es/dashboard/proposals/:request_proposal_id/review/new(.:format)                               dashboard/order_reviews#new {:locale=>"es"}
    new_dashboard_request_proposal_order_review_en GET    /en/dashboard/proposals/:request_proposal_id/review/new(.:format)                               dashboard/order_reviews#new {:locale=>"en"}
 new_dashboard_request_proposal_order_review_es_ar GET    /es-ar/dashboard/proposals/:request_proposal_id/review/new(.:format)                            dashboard/order_reviews#new {:locale=>"es-ar"}

But not a new_dashboard_request_proposal_order_review unlocalized helper. I'll provide a failing test (and/or a patch) if you don't know either how to fix it off the top of your head!

Thank you in advance.

Problems with routing mapper (rails 4.2 beta4) can't start server

After installing the route_translator gem, i can't start my server.

Getting this error:

/Users/Mathijs/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.2.0.beta4/lib/action_dispatch/routing/mapper.rb:81:in `initialize': wrong number of arguments (4 for 6) (ArgumentError)

Using ruby 2.1.5

Anyone suggestions?

generate_unlocalized_routes results in default locale path rendering in url_for

As I mentioned in #26, when I add generate_unlocalized_routes to true in an initializer, everything works except that the paths rendered on the page fall back to the default url. For example, with an app using English as the default locale, when visiting the Spanish page, everything is translated except for links on the page. Those are still rendering the default url paths instead of the spanish ones. Visiting a link would, of course, take the user back to the English page.

I tried to reproduce this using tests, but unfortunately, I can't reproduce the problem. Please see this commit:
astjohn@42adc52

Any insight is greatly appreciated.

Routes locale

I have in my routes:
localized do
scope ':locale' do

end
end
When I use it I have double locale path. How to use this gem in this issue or modify ??

Does not properly generate route with mandatory :format segment

I have added the following test:

  def test_route_with_mandatory_format
    draw_routes do
      localized do
        get 'people.:format', :to => 'people#index'
      end
    end

    assert_routing '/es/gente.xml', :controller => 'people', :action => 'index', :format => 'xml', :locale => 'es'
    assert_routing '/people.xml', :controller => 'people', :action => 'index', :format => 'xml', :locale => 'en'
  end

It fails with

TranslateRoutesTest#test_formatted_route [/home/vk/route_translator/test/routing_test.rb:297]:
No route matches "/es/gente.xml"

(The same for /people.xml - no route matches).

But if I change .:format to (.:format) it works.

Can't use generated routes on controller specs

I'm using your gem with rails 3.2 and receiving undefined method for generated path on my controller specs. Here is an example, the error raised is: undefined method home_user_path'``.

Controller spec:

      context 'and connects with existent user' do
        let(:user) { Factory(:user) }
        let(:omniauth) do
          OmniAuth.config.mock_auth[:some_provider].merge({
            :info => {
              :email => user.email,
              :first_name => user.first_name,
              :last_name => user.last_name
            }
          })
        end

        before do
          request.env['omniauth.auth'] = omniauth
          get :create, :locale => 'pt-BR'
        end

        it "should set current user" do
          UserSession.find.user.should == user
        end

        it { should set_the_flash.
             to(I18n.t("facebook_connect_account_association")) }
        it { should redirect_to(home_user_path(user))  }
      end

Routes:

    resources :users, :except => [:index] do
      member do
        get :edit_account
        put :update_account
        get :forgot_password
        post :forgot_password
        get :signup_completed
        get :invite
        put :deactivate
        get :home
        get :my_wall
        get :account
        get :contacts_endless
        get :environments_endless
        get :show_mural
        get :curriculum
      end
    end

rake routes

                              edit_account_user_pt_br GET    /pessoas/:id/Edit%20account(.:format)                                        users#edit_account {:locale=>"pt-BR"}
                            update_account_user_pt_br PUT    /pessoas/:id/update_account(.:format)                                        users#update_account {:locale=>"pt-BR"}
                           forgot_password_user_pt_br GET    /pessoas/:id/forgot_password(.:format)                                       users#forgot_password {:locale=>"pt-BR"}
                                                      POST   /pessoas/:id/forgot_password(.:format)                                       users#forgot_password {:locale=>"pt-BR"}
                          signup_completed_user_pt_br GET    /pessoas/:id/signup_completed(.:format)                                      users#signup_completed {:locale=>"pt-BR"}
                                    invite_user_pt_br GET    /pessoas/:id/convidar(.:format)                                              users#invite {:locale=>"pt-BR"}
                                deactivate_user_pt_br PUT    /pessoas/:id/deactivate(.:format)                                            users#deactivate {:locale=>"pt-BR"}
                                      home_user_pt_br GET    /pessoas/:id/home(.:format)                                                  users#home {:locale=>"pt-BR"}
                                   my_wall_user_pt_br GET    /pessoas/:id/meu_mural(.:format)                                             users#my_wall {:locale=>"pt-BR"}
                                   account_user_pt_br GET    /pessoas/:id/account(.:format)                                               users#account {:locale=>"pt-BR"}
                          contacts_endless_user_pt_br GET    /pessoas/:id/contacts_endless(.:format)                                      users#contacts_endless {:locale=>"pt-BR"}
                      environments_endless_user_pt_br GET    /pessoas/:id/environments_endless(.:format)                                  

The default locale is pt-BR

And here is my configuration file:

RouteTranslator.config do |config|
  config.generate_unlocalized_routes = false
end

weird error

hi,

from time to time I have this error
undefined method `cars_fr_en_path' for #<#<Class:...'
it put all language in path. Is there anything to do for this ?

thanks

uft8 - russian and others special caracters

Hi,

thanks for this great tool, it save me lot of time. But unfortunatly Im stuck because special caracters are not recognized.
for instance for page /ru/войти , I have this error message
No route matches [GET] "/ru/%D0%B2%D0%BE%D0%B9%D1%82%D0%B8"

same for french special caracters like "è" . for /fr/dernière ,
No route matches [GET] "/fr/derni%C3%A8re"

but if I change in i18n-routes.yml to derniere, /fr/derniere is working fine.

if this caracters are inside variable, it is working well
for instance if my route is like 'derniere-:myvar'
if I go to page /fr/derniere-première
it is working well and I have params[:myvar] = "première"

Is there anythink I can do to make it works ?

thanks

PS : rake routes give me the right routes

PS 2 : on google, I found that this used to be a bug on rails, bug it is said to be fixed, they add Rack::Utils.escape so that we dont have to do it manually on routes.rb. In actionpack/lib/action_dispatch/routing/mapper.rb, they do
mapping = Mapping.new(@set, @scope, URI.parser.escape(path), options) , maybe it can help ;-)
Im using rails 3.2.13

problem with routes like '...(/p:p)'

That's my error:

Uncaught exception:
parse error on value "$" ($end)
/home/maoz/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/racc/parser.rb:529:in `on_error'
/home/maoz/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/racc/parser.rb:258:in ...

And that's problematic rout:
get '/photographers/favorite(/p:p)' => 'photographers#favorite', :as => 'favorite_photographers'

Such construction works:
get '/photographers/favorite(/p(:p))' or get '/photographers/favorite(/:p)'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.