0

私の開発マシン(windows xp、ROR 3.0.3、SQLite3)ではすべてが正常に機能しました。

アプリケーションを本番サーバー(FreeBSD 8.2-RELEASE、Apache 2.2、ROR 3.0.4、MySQL)に移動すると、このエラーが発生しましたが、新しい登録ページでのみ発生しました。

ログインしようとすると(データベースにユーザーがいない)、パスワードチェックが機能しているようです(パスワードが間違っていると表示されますが、これで問題ありません)。

問題は本番サーバーでのみ発生し、開発サーバーでは問題ありません。どうなり得るか?

ありがとう!

[編集]2011年8月9日追加:

ルート.rb:

  #USERS
  get "/user/stat"
  devise_for :users do
    get "/login" => "devise/sessions#new"
    get "/logout" => "devise/sessions#destroy"
  end
  get "/users" => "user#index"
  resources :user

registations_controller.rb:

  # GET /resource/sign_up
  def new
    build_resource({})
    render_with_scope :new
  end

  protected

    # Build a devise resource passing in the session. Useful to move
    # temporary session data to the newly created user.
    def build_resource(hash=nil)
      hash ||= params[resource_name] || {}
      self.resource = resource_class.new_with_session(hash, session)
    end

log / Production.log:

Started GET "/users/sign_up" for 192.168.5.7 at 2011-08-09 13:40:31 +0400
  Processing by Devise::RegistrationsController#new as HTML
  SQL (31.7ms)  SHOW TABLES
Completed   in 33ms

NoMethodError (undefined method `new_with_session' for #<Class:0x284ac6a8>):
  app/controllers/registrations_controller.rb:71:in `build_resource'
  app/controllers/registrations_controller.rb:8:in `new'
4

1 に答える 1

0

アプリディレクトリの所有者をHTTPDプロセスの所有者と同じユーザーに変更します。

$ chown -R <username> <your_app_dir>

例えば

$ chown -R www /usr/local/www/apache22/data

Deviseを更新します。

$ bundle update

Gemfileは、最新のDeviseバージョンを指定します。

gem 'devise'

それは私のために働いた。

于 2011-08-11T12:26:02.567 に答える