rails-routing

Routing error - uninitialized constant

谁说我不能喝 提交于 2020-01-20 17:11:06
问题 I could not fix this in Rails 3.2.12, maybe I am missing something. config/routes.rb get "home/index" root :to => "home#index" devise_for :users, :only => :omniauth_callbacks match 'users/auth/:provider/callback' => 'authentications#create' match '/auth/:provider/signout' => 'authentications#signout' app/controllers/authentication_controller.rb class AuthenticationsController < ApplicationController ... end app/models/authentication.rb class Authentication < ActiveRecord::Base ... end I think

Routing error - uninitialized constant

一个人想着一个人 提交于 2020-01-20 17:09:10
问题 I could not fix this in Rails 3.2.12, maybe I am missing something. config/routes.rb get "home/index" root :to => "home#index" devise_for :users, :only => :omniauth_callbacks match 'users/auth/:provider/callback' => 'authentications#create' match '/auth/:provider/signout' => 'authentications#signout' app/controllers/authentication_controller.rb class AuthenticationsController < ApplicationController ... end app/models/authentication.rb class Authentication < ActiveRecord::Base ... end I think

Routes with Dash `-` Instead of Underscore `_` in Ruby on Rails

删除回忆录丶 提交于 2020-01-19 04:44:49
问题 I want my urls to use dash - instead of underscore _ as word separators. For example controller/my-action instead of controller/my_action . I'm surprised about two things: Google et al. continue to distinguish them. That Ruby on Rails doesn't have a simple, global configuration parameter to map - to _ in the routing. Or does it? The best solution I've is to use :as or a named route. My idea is to modify the Rails routing to check for that global config and change - to _ before dispatching to

Routes with Dash `-` Instead of Underscore `_` in Ruby on Rails

时光总嘲笑我的痴心妄想 提交于 2020-01-19 04:44:24
问题 I want my urls to use dash - instead of underscore _ as word separators. For example controller/my-action instead of controller/my_action . I'm surprised about two things: Google et al. continue to distinguish them. That Ruby on Rails doesn't have a simple, global configuration parameter to map - to _ in the routing. Or does it? The best solution I've is to use :as or a named route. My idea is to modify the Rails routing to check for that global config and change - to _ before dispatching to

Ruby on Rails redirect how to pass params in routes file

与世无争的帅哥 提交于 2020-01-13 13:09:35
问题 We recently changed the product name on our website from 'bracelets' to 'wristbands' and need to keep the old routes around for SEO purposes. Essentially, these routes www.hostname.com/products/bracelets/series-1/ www.hostname.com/products/bracelets/series-1/small-purple should route to www.hostname.com/products/wristbands/series-1/ www.hostname.com/products/wristbands/series-1/small-purple I am reading the tutorial here http://guides.rubyonrails.org/routing.html#redirection and looks like i

Ruby on Rails redirect how to pass params in routes file

你。 提交于 2020-01-13 13:08:35
问题 We recently changed the product name on our website from 'bracelets' to 'wristbands' and need to keep the old routes around for SEO purposes. Essentially, these routes www.hostname.com/products/bracelets/series-1/ www.hostname.com/products/bracelets/series-1/small-purple should route to www.hostname.com/products/wristbands/series-1/ www.hostname.com/products/wristbands/series-1/small-purple I am reading the tutorial here http://guides.rubyonrails.org/routing.html#redirection and looks like i

Named routes inserting a . instead of a /

旧城冷巷雨未停 提交于 2020-01-05 12:08:24
问题 I've been having trouble with named routes in rails 4 (Named route for non resource nesting). I've moved onto something else, but still struggling with the same problem of named routes for non resource urls. This is my route from rake routes : GET /messages/:id/report/:reply_token(.:format) messages#report messages POST /messages(.:format) messages#create and my routes.rb resources :messages, only: [:create] do member do get 'report/:reply_token', :action => 'report'#, :as => :message end end

No route matches [GET] “/book/list”

半城伤御伤魂 提交于 2020-01-05 07:53:08
问题 I am using Rails 3.2.7. I have a controller and a action as it's shown below: class BookController < ApplicationController def list @books = Book.find(:all) end end I also created a model with the name book.rb under model and a list.rhtml inside \app\views\book folder. When I hit http://127.0.0.1:3000/book/list , I am getting this error: No route matches [GET] "/book/list"** Here's config/routes.rb : Ravi::Application.routes.draw do # The priority is based upon order of creation: # first

How do I get the format of my URLs to be username/controller/:id in Rails 3.1?

旧城冷巷雨未停 提交于 2020-01-03 01:51:55
问题 I want it similar to the way Twitter handles the URLs for its tweets. For instance, right now my URL looks like this: mydomain.com/feedbacks/1/ , where feedbacks is the name of the controller. I want it to look like: mydomain.com/username/feedbacks/1/ which is similar to Twitter's: twitter.com/username/status/:id/ . My routes.rb looks like this: resources :users do resources :feedbacks end When I have it like this, it gives me the URLs as mydomain.com/users/1/feedbacks , but I want the actual

How can I make routes from a Rails 3 engine available to the host application?

谁说胖子不能爱 提交于 2020-01-01 01:53:08
问题 I have a Rails 3 application with several engines containing additional functionality. Each engine is a separate service that customers can purchase access to. I am, however, having a problem with routes from the engines that aren't readily available to the controllers and views. controller: class ClassroomsController < ApplicationController .. respond_to :html def index respond_with(@classrooms = @company.classrooms.all) end def new respond_with(@classroom = @company.classrooms.build) end ..