Nico_Arbogast
unread,Feb 16, 2011, 1:37:31 PM2/16/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to I18n Routing
Hi,
First, thank you for the gem.
It is really helpful and very efficient.
I had no problem working with it until I updated my gems to the latest
actionpack 3.0.4 tonight.
When launching the app on my local server, it broke and displayed an
error (see details below)
The error was coming from the "localization process" of a named route
in my route.rb file where I had the following code (which is perfectly
running and localized when working with actionpack 3.0.3):
<<
match 'named_route(/:param1(/:param2))' => "controller#action", :as
=> "name"
>>
Going back to actionpack 3.0.4 by writing the following in my Gemfile
fixed it instantly:
<<
gem 'actionpack', '3.0.3'
>>
I have no time right now to go into the actionpack change causing this
bug. I'm sorry.
SOME MORE DETAILS:
The error when launching the app locally:
<<
/opt/local/lib/ruby/gems/1.9.1/gems/rack-mount-0.6.13/lib/rack/mount/
route_set.rb:62:in `add_route': conditions may only include
[:auth_type, :gateway_interface, :path_translated, :remote_host, :remote_ident, :remote_user, :remote_addr, :server_name, :server_protocol, :accept, :accept_charset, :accept_encoding, :accept_language, :cache_control, :from, :negotiate, :pragma, :key?, :request_method, :request_method_symbol, :method, :method_symbol, :get?, :post?, :put?, :delete?, :head?, :headers, :fullpath, :forgery_whitelisted?, :forgery_whitelisted_with_deprecation?, :forgery_whitelisted_without_deprecation?, :media_type, :content_length, :xml_http_request?, :xhr?, :ip, :remote_ip, :server_software, :raw_post, :body, :form_data?, :body_stream, :reset_session, :session=, :session_options=, :GET, :query_parameters, :POST, :request_parameters, :authorization, :local?, :cookie_jar, :flash, :url, :scheme, :protocol, :ssl?, :raw_host_with_port, :host, :host_with_port, :port, :standard_port, :standard_port?, :port_string, :server_port, :domain, :subdomains, :subdomain, :request_uri, :filtered_parameters, :filtered_env, :parameters, :params, :path_parameters=, :symbolized_path_parameters, :path_parameters, :content_mime_type, :content_type, :accepts, :format, :formats, :format=, :negotiate_mime, :if_modified_since, :if_none_match, :not_modified?, :etag_matches?, :fresh?, :env, :script_name, :path_info, :query_string, :session, :session_options, :logger, :media_type_params, :content_charset, :script_name=, :path_info=, :options?, :trace?, :parseable_data?, :
[], :
[]=, :values_at, :referer, :referrer, :user_agent, :cookies, :path, :taguri=, :taguri, :to_yaml_style, :to_yaml_properties, :syck_to_yaml, :blank?, :present?, :presence, :duplicable?, :acts_like?, :try, :html_safe?, :with_options, :to_param, :to_query, :returning, :dclone, :to_yaml, :`, :to_json, :instance_values, :instance_variable_names, :copy_instance_variables_from, :as_json, :is_haml?, :meta_class, :share_examples_for, :shared_examples_for, :share_as, :describe, :pretty_print, :pretty_print_cycle, :pretty_print_instance_variables, :pretty_print_inspect, :delay, :__delay__, :send_later, :send_at, :require_or_load, :require_dependency, :require_association, :load_dependency, :load, :require, :unloadable, :nil?, :===, :=~, :!
~, :eql?, :hash, :<=>, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :to_s, :inspect, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?, :extend, :display, :public_method, :define_singleton_method, :__id__, :object_id, :to_enum, :enum_for, :gem, :silence_warnings, :enable_warnings, :with_warnings, :silence_stderr, :silence_stream, :suppress, :class_eval, :__called_from__, :expirable_memoize, :require_library_or_gem, :debugger, :breakpoint, :pretty_inspect, :suppress_warnings, :should, :should_not, :==, :equal?, :!, :!
=, :instance_eval, :instance_exec, :__send__, :i18n_locale]
(ArgumentError)
from /opt/local/lib/ruby/gems/1.9.1/gems/actionpack-3.0.4/lib/
action_dispatch/routing/route_set.rb:299:in `add_route'
from /opt/local/lib/ruby/gems/1.9.1/gems/i18n_routing-0.4.5/lib/
i18n_routing_rails3.rb:195:in `block in match'
from /opt/local/lib/ruby/gems/1.9.1/gems/i18n_routing-0.4.5/lib/
i18n_routing_rails3.rb:191:in `each'
from /opt/local/lib/ruby/gems/1.9.1/gems/i18n_routing-0.4.5/lib/
i18n_routing_rails3.rb:191:in `match'
>>
The error was coming from a named route in my route.rb file where I
had the following code (which is perfectly running and localized when
working with actionpack 3.0.3):
<<
match 'named_route(/:param1(/:param2))' => "controller#action", :as
=> "name"
>>
In my locales .yml files I have
<<
named_routes_path:
'named_route(/:param1(/:param2))' :
"translation(/:param1(/:param2))"
>>
Going back to actionpack 3.0.4 by writing the following in my Gemfile
fixed it instantly:
<<
gem 'actionpack', '3.0.3'
>>
NB: every other localized routes seemed to worked fine with actionpack
3.0.4:
With actionpack 3.0.4, when I changed my routes.rb to
<<
match 'named_route(/:param1(/:param2))', :to =>
"controller#action", :as => "name"
>>
this named route was "working" again (i.e. not breaking the app and
responding to url requests and displayed when raking routes) but it
was not translated anymore (i think the if condition in
your(i18n_routing_rails3) "match" method was not verified so it was
skipping this route when localizing).
Other localized routes where translated and working fine
Hope it helps someone!
For the moment, I will keep actionpack to version 3.0.3 to keep
everything stable when pushing my app to production.
Thanks again
Nico