我的设计在几天前运作良好。 似乎在发送电子邮件之前某些参数丢失了: 这是堆栈跟踪,它确认设计正在将电子邮件保存在数据库中:
Processing by Devise::InvitationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"9Cj9YYy7gPbVbplSAHs+a3DkUxAYU00oMJUG11dIMAI=", "athlete"=>{"email"=>"asdfasdf@asdf.dk"}, "commit"=>"Send an invitation"}
Admin Load (0.2ms) SELECT "admins".* FROM "admins" WHERE "admins"."id" = 1 LIMIT 1
Athlete Load (0.2ms) SELECT "athletes".* FROM "athletes" WHERE "athletes"."email" = 'asdfasdf@asdf.dk' LIMIT 1
Athlete Exists (0.2ms) SELECT 1 AS one FROM "athletes" WHERE "athletes"."email" = 'asdfasdf@asdf.dk' LIMIT 1
Athlete Load (0.1ms) SELECT "athletes".* FROM "athletes" WHERE "athletes"."invitation_token" = 'aDop2Zd7DUSu94zydpy2' LIMIT 1
(0.1ms) begin transaction
SQL (0.6ms) INSERT INTO "athletes" ("current_sign_in_at", "current_sign_in_ip", "email", "encrypted_password", "invitation_accepted_at", "invitation_limit", "invitation_sent_at", "invitation_token", "invited_by_id", "invited_by_type", "last_sign_in_at", "last_sign_in_ip", "remember_created_at", "reset_password_sent_at", "reset_password_token", "sign_in_count") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["current_sign_in_at", nil], ["current_sign_in_ip", nil], ["email", "asdfasdf@asdf.dk"], ["encrypted_password", ""], ["invitation_accepted_at", nil], ["invitation_limit", nil], ["invitation_sent_at", Mon, 14 Jan 2013 12:59:46 UTC +00:00], ["invitation_token", "aDop2Zd7DUSu94zydpy2"], ["invited_by_id", 1], ["invited_by_type", "Admin"], ["last_sign_in_at", nil], ["last_sign_in_ip", nil], ["remember_created_at", nil], ["reset_password_sent_at", nil], ["reset_password_token", nil], ["sign_in_count", 0]]
(619.1ms) commit transaction
Completed 500 Internal Server Error in 701ms
ArgumentError (wrong number of arguments (2 for 1)):
devise_invitable (1.1.4) lib/devise_invitable/mailer.rb:5:in `invitation_instructions'
actionpack (3.2.11) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.11) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.11) lib/abstract_controller/rendering.rb:45:in `process'
actionmailer (3.2.11) lib/action_mailer/base.rb:458:in `process'
actionmailer (3.2.11) lib/action_mailer/base.rb:452:in `initialize'
actionmailer (3.2.11) lib/action_mailer/base.rb:439:in `new'
actionmailer (3.2.11) lib/action_mailer/base.rb:439:in `method_missing'
devise (2.2.1) lib/devise/models/authenticatable.rb:159:in `send_devise_notification'
devise_invitable (1.1.4) lib/devise_invitable/model.rb:168:in `deliver_invitation'
devise_invitable (1.1.4) lib/devise_invitable/model.rb:132:in `invite!'
devise_invitable (1.1.4) lib/devise_invitable/model.rb:240:in `_invite'
devise_invitable (1.1.4) lib/devise_invitable/model.rb:252:in `invite!'
devise_invitable (1.1.4) app/controllers/devise/invitations_controller.rb:16:in `create'
actionpack (3.2.11) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.11) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.11) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.11) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.11) lib/active_support/callbacks.rb:447:in `_run__4580775493151678536__process_action__2740541638652288271__callbacks'
activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.11) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.11) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.11) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.11) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.11) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.11) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.11) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.11) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.11) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.11) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.11) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.11) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.11) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.11) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:36:in `call'
actionpack (3.2.11) lib/action_dispatch/routing/mapper.rb:42:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:601:in `call'
warden (1.2.1) lib/warden/manager.rb:35:in `block in call'
warden (1.2.1) lib/warden/manager.rb:34:in `catch'
warden (1.2.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.4) lib/rack/etag.rb:23:in `call'
rack (1.4.4) lib/rack/conditionalget.rb:35:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.4) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.4) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.11) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `_run__1152214596362570374__call__1601018742063366623__callbacks'
activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.11) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.11) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.11) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.11) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.11) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.11) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.11) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.4) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.4) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.11) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.4) lib/rack/lock.rb:15:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.11) lib/rails/engine.rb:479:in `call'
railties (3.2.11) lib/rails/application.rb:223:in `call'
rack (1.4.4) lib/rack/content_length.rb:14:in `call'
railties (3.2.11) lib/rails/rack/log_tailer.rb:17:in `call'
thin (1.5.0) lib/thin/connection.rb:81:in `block in pre_process'
thin (1.5.0) lib/thin/connection.rb:79:in `catch'
thin (1.5.0) lib/thin/connection.rb:79:in `pre_process'
thin (1.5.0) lib/thin/connection.rb:54:in `process'
thin (1.5.0) lib/thin/connection.rb:39:in `receive_data'
eventmachine (1.0.0) lib/eventmachine.rb:187:in `run_machine'
eventmachine (1.0.0) lib/eventmachine.rb:187:in `run'
thin (1.5.0) lib/thin/backends/base.rb:63:in `start'
thin (1.5.0) lib/thin/server.rb:159:in `start'
rack (1.4.4) lib/rack/handler/thin.rb:13:in `run'
rack (1.4.4) lib/rack/server.rb:268:in `start'
railties (3.2.11) lib/rails/commands/server.rb:70:in `start'
railties (3.2.11) lib/rails/commands.rb:55:in `block in <top (required)>'
railties (3.2.11) lib/rails/commands.rb:50:in `tap'
railties (3.2.11) lib/rails/commands.rb:50:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'
Rendered /Users/anderskonring/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.11/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.1ms)
Rendered /Users/anderskonring/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.11/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.1ms)
Rendered /Users/anderskonring/.rvm/gems/ruby-1.9.3-p194/gems/actionp
我试图弄清楚错误隐藏的地方,但我很确定它是设计的默认配置。 奇怪的是,我的浏览器显示电子邮件不再是参数的一部分:
Request
Parameters:
{"utf8"=>"✓",
"authenticity_token"=>"9Cj9YYy7gPbVbplSAHs+a3DkUxAYU00oMJUG11dIMAI=",
"athlete"=>{},
"commit"=>"Send an invitation"}
不知道是否有任何帮助,但我也在发布我的路线:
App::Application.routes.draw do
root :to => 'home#index'
# Devise for admins and athletes but no registration possible
# without an invitation
devise_for :admins do
get 'admins/edit' => 'devise/registrations#edit', :as => 'edit_admins_registration'
put 'admins' => 'devise/registrations#update', :as => 'admin_registration'
end
devise_for :athletes, :except => :invitable do
get 'athletes/edit' => 'devise/registrations#edit', :as => 'edit_athletes_registration'
put 'athletes' => 'devise/registrations#update', :as => 'athlete_registration'
end
# Common ressource url for both athletes and admins
# events are nested for athletes (note: athlete --hasmany--> events)
resources :athletes do
resources :events, :only => [:index, :show]
resources :attachments, :only => [:create, :index, :new, :destroy]
post 'exportcal' => 'athletes#exportcal'
end
resources :admins
end
答案 0 :(得分:1)
gem 'devise', :git => "git://github.com/plataformatec/devise.git", :branch => 'master'
gem 'devise_invitable', '~> 1.0.0'
如果你知道如何使用没有错误的最新版本,请发表评论。
答案 1 :(得分:1)
同样的事发生在我身上。这里讨论并解决了这个问题:
https://github.com/scambra/devise_invitable/issues/265
我的解决方案:
gem 'devise'
gem 'devise_invitable', :git => "git://github.com/scambra/devise_invitable.git", :branch => 'master'
目前给我的是:
Using devise (2.2.1)
Using devise_invitable (1.1.4) from git://github.com/scambra/devise_invitable.git (at master)