Working Title
Working Title

Reputation: 254

Rails URLs Not working

I'm going to try to make a very long story short here. I was building an application in RefineryCMS on an Ubuntu server and everything was working fine until I started getting the following error message:

.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)

I was able to solve this error by running

gem install devise

followed by

bundle install

and

bundle update

This solved the problem of it not booting but none of the urls worked including default ones such as /users/login and anytime I would navigate to such a page I would page showing an error such as

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

Thinking this was an issue with my gemset I created a new one and set up a new one and then started new refinery application with the intention of moving my files over to it. However when booting it up to ensure that refinery was working it took me to the default rails page and after deleting /public/index.html I booted it again and got the same error

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

To double check that refinery was working I ran a simple command line command to override the /app/views/pages/show.html.erb file which worked fine and then booted it up again and manually entered the url to the users/register page and again got the same route error. Which all but confirms that its some issue with the way my routes are being interpreted though I don't know on what level.

I am using rails version 3.0.12, webrick 1.3.1 and ruby 1.9.2 in the original application.

Currently this is my 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

And my routes.rb file looks like:

 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

Why might have caused it to stop recognizing the built in refinery routes on either the original application or the new one started after the fact? Is there a way to fix it? If not is there a way to roll things back to a point where they were working properly?

Upvotes: 0

Views: 353

Answers (1)

Russell
Russell

Reputation: 12439

It looks to me like you might have done part of the devise setup but not all. Have you run both the generators?

rails generate devise:install
rails generate devise User

Your routes.rb would normally contain something like: devise_for :users if it had been set up correctly. This is what creates all the routes like user/sign_in.

Upvotes: 1

Related Questions