0

ここでは非常に長い話を短くしようと思います。Ubuntu サーバー上の RefineryCMS でアプリケーションを構築していましたが、次のエラー メッセージが表示されるまで、すべて正常に動作していました。

.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.12/lib/active_support/dependencies.rb:242:in `require': no such file to load -- devise (LoadError)

実行することでこのエラーを解決できました

gem install devise

に続く

bundle install

bundle update

これにより、起動しないという問題は解決しましたが、 /users/login などのデフォルトのものを含め、どの URL も機能しませんでした。そのようなページに移動すると、次のようなエラーが表示されます。

No route matches [GET] "/users/login"

これは自分の gemset の問題だと思い、新しい gemset を作成してセットアップし、ファイルをそこに移動する目的で新しいリファイナリー アプリケーションを開始しました。ただし、リファイナリーが機能していることを確認するために起動すると、デフォルトのレールページが表示され、/public/index.html を削除した後、再度起動して同じエラーが発生しました。

No route matches [GET] "/users/login"

リファイナリが機能していることを再確認するために、単純なコマンド ライン コマンドを実行して /app/views/pages/show.html.erb ファイルをオーバーライドしました。再び同じルートエラーが発生しました。どのレベルかはわかりませんが、ルートが解釈される方法に問題があることを確認しています。

元のアプリケーションでは、rails バージョン 3.0.12、webrick 1.3.1、および ruby​​ 1.9.2 を使用しています。

現在、これは私のGemfileです:

source 'http://rubygems.org'

gem "devise"
gem "savon"
gem 'refinerycms-testing'
gem "factory_girl_rails"
gem "guard-rspec"
gem "rspec"

# gem 'rails', '3.0.0'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3', :require => 'sqlite3'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug'

# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'

# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
#   gem 'webrat'
# end

# REFINERY CMS ================================================================
# Anything you put in here will be overridden when the app gets updated.

#gem 'refinerycms',              '~> 1.0.9'

=begin #testing
group :development, :test do
    # To use refinerycms-testing, uncomment it (if it's commented out) and run 'bundle install'
    # Then, run 'rails generate refinerycms_testing' which will copy its support files.
    # Finally, run 'rake' to run the tests.
    #gem 'refinerycms-testing'
    gem 'capybara-webkit'

     if RbConfig::CONFIG['target_os'] =~ /darwin/i
       gem 'growl'
    end

   gem 'spork', '~> 0.9.0.rc', :platforms => :ruby
   gem 'guard-spork', :platforms => :ruby
   gem 'guard-rspec', :platforms => :ruby
   gem 'generator_spec'
 end

 =end #testing

 # END REFINERY CMS ============================================================

 # USER DEFINED


   # Specify additional Refinery CMS Engines here (all optional):
   # gem 'refinerycms-inquiries',    '~> 1.0'
   # gem "refinerycms-news",         '~> 1.2'
   # gem 'refinerycms-blog',         '~> 1.6'
   # gem 'refinerycms-page-images',  '~> 1.0'

   # Add i18n support (optional, you can remove this if you really want to).
   #gem 'refinerycms-i18n',         '~> 1.0.0'

 # END USER DEFINED

そして、私の routes.rb ファイルは次のようになります:

 Quicksmile::Application.routes.draw do

   match "/" => redirect("/new-practices") 

   # The priority is based upon order of creation:
   # first created -> highest priority.

   # Sample of regular route:
   #   match 'products/:id' => 'catalog#view'
   # Keep in mind you can assign values other than :controller and :action

   # Sample of named route:
   #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
   # This route can be invoked with purchase_url(:id => product.id)

   # Sample resource route (maps HTTP verbs to controller actions automatically):
   #   resources :products

   # Sample resource route with options:
   #   resources :products do
   #     member do
   #       get 'short'
   #       post 'toggle'
   #     end
   #
   #     collection do
   #       get 'sold'
   #     end
   #   end

   # Sample resource route with sub-resources:
   #   resources :products do
   #     resources :comments, :sales
   #     resource :seller
   #   end

   # Sample resource route with more complex sub-resources
   #   resources :products do
   #     resources :comments
   #     resources :sales do
   #       get 'recent', :on => :collection
   #     end
   #   end

   # Sample resource route within a namespace:
   #   namespace :admin do
   #     # Directs /admin/products/* to Admin::ProductsController
   #     # (app/controllers/admin/products_controller.rb)
   #     resources :products
   #   end

   # You can have the root of your site routed with "root"
   # just remember to delete public/index.html.

   # See how all your routes lay out with "rake routes"

   # This is a legacy wild controller route that's not recommended for RESTful applications.
   # Note: This route will make all actions in every controller accessible via GET requests.
   # match ':controller(/:action(/:id(.:format)))'
 end

元のアプリケーションまたは事後に開始された新しいアプリケーションのいずれかで、組み込みのリファイナリ ルートの認識が停止したのはなぜでしょうか? それを修正する方法はありますか?そうでない場合、適切に機能していたポイントにロールバックする方法はありますか?

4

1 に答える 1

1

デバイスのセットアップの一部を行ったように見えますが、すべてではありません。両方のジェネレーターを実行しましたか?

rails generate devise:install
rails generate devise User

通常routes.rb、次のようなものが含まれますdevise_for :users。正しく設定されている場合。これは、のようなすべてのルートを作成するものuser/sign_inです。

于 2012-04-18T22:26:20.287 に答える