Routing error – uninitialized constant
Rails requires the file name to match the class name. Therefore you should rename app/controllers/authentication_controller.rb to app/controllers/authentications_controller.rb.
Rails requires the file name to match the class name. Therefore you should rename app/controllers/authentication_controller.rb to app/controllers/authentications_controller.rb.
Routes on collections are listed here. The difference between :on => :collection and :on => :member are the style of route they produce and their associated route helpers. resources :posts do # on collection get ‘search’, on: :collection # –> generates ‘/posts/search’ and search_posts_path # on member get ‘share’, on: :member # –> generates’/posts/:id/share’ and … Read more
The error you’re making is actually a pretty common one. Basically, Rails automatically maps URLs for your scaffolds. So when you created the Posts scaffolds, Rails is mapping the URL routes for it. One such route is the URL for viewing a single post: /posts/(post_id) So, when you’re entering the URL /posts/start Rails thinks you’re … Read more
Add this in your routes: resources :invoices do post :send, on: :member end Or resources :invoices do member do post :send end end Then in your views: <%= button_to “Send Invoice”, send_invoice_path(@invoice) %> Or <%= link_to “Send Invoice”, send_invoice_path(@invoice), method: :post %> Of course, you are not tied to the POST method
Here’s a solution with the rack-cors gem, which you said you tried. As others have mentioned, you didn’t give much detail in regards to which front-end framework you’re using and what the actual request looks like. So the following may not apply to you, but I hope it helps someone. In my case, the gem … Read more
Just so that it’s useful to someone else , i came across this today request.base_url gives the full path in local as well as on live . request.domain gives just the domain name so it sometimes kinda breaks the link while redirecting
Put the optional parts between parenthesis: map.show_book “/show_book/:name(/year/:year)”, :controller => “book”, :action => “show_version” and remove the second route. Update The above answer is only for rails 3 and above. Inverting the two routes definitions fixed the problem (see Alessandro’s comment below).
With Rails 3 and later you can do like this: resources :user_bundles, :path => ‘/user-bundles’ Another option is to modify Rails, via an initializer. I don’t recommend this though, since it may break in future versions (edit: doesn’t work in Rails 5). Using :path as shown above is better. # Using private APIs is not … Read more
In Rails 3 and higher: Rails.application.routes.url_helpers e.g. Rails.application.routes.url_helpers.posts_path Rails.application.routes.url_helpers.posts_url(:host => “example.com”)