A
A
anasasiakiri4enko2016-06-10 16:44:22
Ruby on Rails
anasasiakiri4enko, 2016-06-10 16:44:22

Why does rails complain about missing paths in routes.rb?

1. Generate a clean application
2. Generate a welcome controller and an Index method
3. Set up a route to the main page - root 'welcome#index'
4. Generate with the scaffold command - rails g scaffold Item title:string info:text price:decimal
5. I run the rake db:migrate command
Everything goes well and works
I start installing gem`a devise
6. I add gem 'devise' to the Gemfile
7. I run bundle install
8. I run the rails generate devise:install command (follow the suggested instructions and complete the configuration)
8.1 In the file responsible for the development environment, I add config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
8.2 I skip this setting - root to: "home#index" because I already have root_path configured
8.3 In the file responsible for the template, add - <%= notice %> <%= alert %>
8.4 I skip point #4, because I deploy locally and rails version 4.2.6 I also skip point #5 (device view generation)
9. Create a device model file with the rails g devise Admin command
10. Run the migration - everything is ok
11. And then rails swears like this: fd9095511c4f4ff8b2169b337545f5c9.png
12. Here is the routes.rb file itself The funny thing is that if I omit the line devise_for: admins1d4975deaf1d4c8189c189345f3d0324.png
in the routes.rb file to the very end, all url`s will immediately work, but in my opinion this is some kind of nonsense. Okay, I omit the devise_for :admins lineto the very end. I look at the list of routes with the rake routes command and see: b798d86afa5a495e926cb4f6acac360a.png
Well, I think, ok. I go to localhost:3000/admins/sign_in - route error - No route matches [GET] "/admins/sign_in"
In controller items I try to add before_action :authenticate_user! and see e6563cd071404167af431f61c2549140.png
what am i doing wrong? Trying different ways based on gem documentation https://github.com/plataformatec/devise Why does rails swear?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
anasasiakiri4enko, 2016-06-10
@anasasiakiri4enko

I got it working , but all I had to do was reload the server. it happens.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question