2011-07-07 55 views
1

我正在使用Devise + Omniauth(Facebook)並最近更新了我的Gems(Rails 3.0.5,Ruby 1.9.2)。在開始我的應用程序服務器的routes.rb下面一行:在Gem更新(Rails 3,Devise + Omniauth)上設計路由錯誤

devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks", :registrations => "registrations" }

已經開始提高了以下錯誤:

/Users/myname/.rvm/gems/ruby-1.9.2-p0/gems/rack-mount-0.6.14/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, :location, :taguri=, :taguri, :to_yaml_style, :to_yaml_properties, :syck_to_yaml, :to_yaml, :blank?, :present?, :presence, :duplicable?, :acts_like?, :try, :html_safe?, :to_json, :instance_values, :instance_variable_names, :copy_instance_variables_from, :as_json, :with_options, :to_param, :to_query, :friendly_id?, :unfriendly_id?, :to_html, :dclone, :`, :returning, :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, :suppress_warnings, :require_library_or_gem, :debugger, :breakpoint, :==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__] (ArgumentError) 

有沒有這種方式命名路由新的語法?

match "#{path_prefix}/:action/callback", #:action => Regexp.union(mapping.to.omniauth_providers.map(&:to_s)), 

但是要注意,這只是一個醜陋的黑客攻擊不是一個最終的解決方案:

+1

我已經暫時解決這個通過恢復到軌3.0.3 – neon

+0

我目前正在經歷3.0.7。對於任何試圖診斷的人來說都是一個提示:當模型爲:omniauthable時,即使沒有其他選項傳遞給devise_for,我也會得到這個錯誤:用戶 –

回答

1

您可以通過在色器件-1.4.2/lib目錄/色器件/導軌/ routes.rb中不斷變化的管道338本事解決問題!

確保您已在色器件模型(例如用戶)設置

devise :omniauthable, :omniauth_providers => [:twitter] 

+0

@norm您是否有解決方法,是否沒有修補更多最近的設計? –

0

如果與Devise/Omniauth一起使用,請升級至僞造品0.4.0。我們正在擴展一些基本的Ruby類(總是一個好主意,我知道),這在Devise中引起了一些問題。版本0.4.0不再擴展任何ruby基類,並且應該完全安全地包含。如果您在http://github.com/sevenwire/forgery有任何問題,請告知我們。謝謝!

相關問題