The component of the Ruby on Rails framework responsible for mapping between HTTP requests and application resources (including static files and controller actions).
Questions tagged [rails-routing]
969 questions
0
votes
2 answers
How to create a route without an associated View?
I want to create a route such as
get '/referrals/send_invite/:email_address'
I will be calling this route via remote: true and GET. However if I issue the GET request in my browser, the route will still try to find a View, thus leading me…

Goles
- 11,599
- 22
- 79
- 140
0
votes
2 answers
Basic nested routing in Rails 3
NOTE: I have read Routing From the Inside Out AND the Engine Yard blog post on routing.
I'm building a fantasy sports league, I have a League model that supports the seven basic restful operations, and they all work fine.
I've added the following my…

ScottyDont
- 1,207
- 1
- 9
- 17
0
votes
1 answer
Listing files for download, extra path added to link in Rails
I'm trying to show a list of links (in index.html) to text files in a directory, for downloading the file.
Where there is a subdirectory, I want its link to refresh the index page and list the files in that subdirectory (as links for download).
My…

rigyt
- 2,219
- 3
- 28
- 40
0
votes
1 answer
ruby on rails app tutorial can't display micropost page
Hi I'm following a rails tutorial and i've kind of veered off the tutorial to do some different things...& i hit a snag. So the tutorial (michael hartl's) creates a feed of microposts, but it doesn't give each micropost its own page. This is what…

BennyB
- 155
- 4
- 19
0
votes
1 answer
Unreasonable RoutingError for favicon.ico
I have just finished programming an import/export feature for an existing complex website. The way it is set up is that on the games/5 show action, I have an "Import" and an "Export" button. These lead to appropriately-named controller actions,…

Sprachprofi
- 1,229
- 12
- 24
0
votes
1 answer
Rails Routing: URL won't change even after using friendly_id gem
I've been trying for the past 2 days but ultimately failed. I would like to get a URL like this: dresses/type/flower-girl but all I've got is /dresses/type/4
I've got Shop has_many Dresses and Type has_many Dresses. In my Dress table, I've got…

hsym
- 4,217
- 2
- 20
- 30
0
votes
1 answer
link_to fails with other link_to's on the same page, but works alone
Environment:
Rails 3.2.3
Mac OS X Lion
Ruby-1.9.3-p194 (MRI)
I have a rails app and I am using app/views/layouts/application.html.erb as a sort of 'left-nav-pane' for some links I use as menu options.
There are two links using link_to in the…

MotownJoe
- 78
- 5
0
votes
1 answer
Randomizing Rails Root Path between two views?
Is there a way I can switch between to views at random for the root path?
root :to => 'pages#blue' or root :to => 'pages#red'
Thanks for any kind of help with this.

Big_Bird
- 427
- 8
- 21
0
votes
1 answer
How to map all routes into a subdomain in Rails
I have a live Rails app. Now I would like to reroute all of them to a subdomain dev.mydomain.com.
For example, current path mydomain.com/users/1 should become dev.mydomain.com/users/1. All the links in my pages should work also.
How should I do…

AdamNYC
- 19,887
- 29
- 98
- 154
0
votes
1 answer
Rails - routing when nesting with rails - beginner
I am relatively new to programming and to rails so please be indulgent:)
I am building a website for myself which contains a blog. I have two models that are nested and I do not seem to understand how to use REST to perform certain actions on my…

Marius Pop
- 1,431
- 2
- 19
- 32
0
votes
1 answer
Rails Routing and HTTP Verbs
My app is a workout scheduler.
The client typically does workouts at one of three timeslots in a given day, so I'm providing a quick-add function to schedule a morning, noon or evening workout.
I have the code working, but I don't think I'm doing it…

DVG
- 17,392
- 7
- 61
- 88
0
votes
3 answers
what is the proper convention for restful routing via namespaces?
Let's say I have a receipts model, and I want to offer a controller action to print one... The un-restful way would be to do:
# receipt_controller.rb
def print
...
end
#routes.rb
resources :receipts do
get :print, :on => :member
…

patrick
- 9,290
- 13
- 61
- 112
0
votes
1 answer
Getting this link_to helper to invoke a view- getting routing error
I have a users_controller which has this function in it:
def process_csv
puts 'processing csv file'
end
Then I have a show.html.erb file with a "link_to" tag on it.
<%= link_to 'Click HERE to open file', @user.image.url %>
<%=…
<%=…

banditKing
- 9,405
- 28
- 100
- 157
0
votes
1 answer
Detecting whether to show or to process a form based on GET or POST
I've got a User model and an Account controller. When a user visits the /account url, it should show a form containing a text field with the username in it and a button to submit the form.
I have match '/account' => 'account#index' in my routes.
In…

Matthew
- 15,282
- 27
- 88
- 123
0
votes
2 answers
Recommendations for constructing RESTful resources for avatar selection scenario in rails
We have a requirement where a user needs to select their avatar for their profile. On the edit profile page, the user clicks on a Change Picture link which takes them to another page and gives them with two links to get their photo from facebook or…

stantona
- 3,260
- 2
- 24
- 28