Questions tagged [rails-routing]

The component of the Ruby on Rails framework responsible for mapping between HTTP requests and application resources (including static files and controller actions).

969 questions
0
votes
1 answer

Skip Before Filter for Nested Resource

I am currently working on a Rails 3.2 application in which I have two controllers. One is campaign and the other one is posts. Both of them are having a before_filter. Please have a look at the controller and routes below : Campaigns Controller…
Smoke
  • 1,052
  • 1
  • 10
  • 24
0
votes
1 answer

rails 3 routing keep custom url for post

i am fairly new to rails and want to keep the url the same for a user signing in if there is an error and the 'new' template is rendered here are my routes resources :users, only: [:new, :create] resources :sessions, only: [:new, :create,…
Austin
  • 1,129
  • 2
  • 11
  • 18
0
votes
2 answers

Unnamespaced routes within namespaced routes

I have several namespaced routes in an app. Here's a sample namespace "battles" do resources :teams do resources :comments, :module => "comments", :controller=>'comments' end end My problem is that all my resources with comments route to…
John
  • 135
  • 2
  • 11
0
votes
1 answer

Rails link_to action with URL parameters

If I have a route like so get 'controller/:id/action/:param' => 'Controller#action' How can I use link_to to create a link like ? So far I have gotten link_to 'Link text', {:action => 'action'} To give me
arcyqwerty
  • 10,325
  • 4
  • 47
  • 84
0
votes
1 answer

Static route with button_to rails

Is there a way to have the equivalent of <%= link_to "Continue", "/profile" %> but with a button_to? From what I understand you have to use a rails route. like new_user_path or something. I was thinking something like this <%= button_to…
ruevaughn
  • 1,319
  • 1
  • 17
  • 48
0
votes
1 answer

Rails 2.3.11 RESTful route not calling create action from form

I have a controller called "Notes", and its associated model is Note, with a text field called "note" (I know). I have a very simple form in the new.html.erb view: <% form_for(@note) do |f| %>

<%= f.error_messages %> 

RubyRedGrapefruit
  • 12,066
  • 16
  • 92
  • 193
0
votes
2 answers

Routing Error Ruby on Rails

I've installed ruby on rails 3.2.6, and when I execute rails server and access to 127.0.0.1:3000 it works, however when I generate a controller, for example rails generate controller principal and access to 127.0.0.1:3000/somecontroller,…
chenio
  • 592
  • 3
  • 11
  • 27
0
votes
1 answer

Rails: 'match' function in routes.rb escaping slashes in url

I am new to ruby and rails. Here in routes.rb i have added the following line: match 'check/' => "home#index" When i hit url with server running on port 3000: localhost:3000/check/ it works fine, but if i give…
Paritosh Singh
  • 6,288
  • 5
  • 37
  • 56
0
votes
1 answer

Rails 3 Devise Confirmation Routing Error

I ran into a strange routing problem with Devise. Recently I added email confirmation through Devise for my Rails app and I was trying to setup the confirmation/new action so that users could have their email confirmations re-sent…
Noz
  • 6,216
  • 3
  • 47
  • 82
0
votes
1 answer

Is it possible to "map" a controller action to another controller action but changing some parameter?

I am using Ruby on Rails 3.2.2 and I would like to know if it is possible to "map" a controller action to another controller action but changing some parameter. That is, I have followings models and controllers: # File system: #…
Backo
  • 18,291
  • 27
  • 103
  • 170
0
votes
1 answer

Rails url_for namespaced models and non-namespaced controller

I'm trying to generate a URL for a model which is namespaced from a controller which is not. For example: module SomeStuff class Widget < ActiveRecord::Base; end end class WidgetsController < ApplicationController def create w =…
codecraig
  • 3,118
  • 9
  • 48
  • 62
0
votes
2 answers

How to do functional testing of Rails routes with constraints?

I've got a Rails 3 application, and am trying to write tests for all the routing. Imagine this very simple route: resources :jobs, :constraints => {:id => /\d+/} I now wish to test this. In my functional test, it's easy enough to write an assertion…
Tom Morris
  • 3,979
  • 2
  • 25
  • 43
0
votes
0 answers

Rails routes work in console but not server

I'm having trouble with a route that seems to be right in the console but gives me a routing error when I use it in the server. The case is similar to the "edit" and "update" pair. Calling GET 'messages/25/followup' should route to…
Mike Blyth
  • 4,158
  • 4
  • 30
  • 41
0
votes
1 answer

form_for with custom action not rendering

I am working on a very simple project to learn Rails better, coming from a C# background. It seems to be rendering the incorrect form action with my code. It currently has 2 models which are using the routes of resources :leaks resources…
mandreko
  • 1,766
  • 2
  • 12
  • 24
0
votes
1 answer

Clarification on rails collection routes

routes.rb resources :home do get 'download', :on => :collection end rake routes download_home_index GET /home/download(.:format) home#download home_index GET /home(.:format) home#index .... home_controller.rb def…
John Lee
  • 1,241
  • 2
  • 16
  • 29