routes

ASP.NET MVC - Routes and UrlHelper

I have the following route routes.MapRoute( "GigDayListings", // Route name "gig/list/{year}/{month}/{day}", // URL with parameters new { controller = "Gig", action = "List" }, new { year = @"^[0-9]+$"...

Is there a RESTful way to configure routes for habtm?

In Rails you can use nested routes to create RESTful routes for has_one and has_many relationships. Examples can be found on the Rails Guides I'd like to ask if there is a good way to configure RESTful routes for habtm relationships? For example if I have a relationship A-habtm-B, my idea is to configure nested routes for A has_many B, ...

Ruby on rails application root

How do I change a rails app so that a controller foo appears as the application root? In other words, right now all the urls look like host.com/foo/... and I'd like to get rid of the foo and have simply host.com/... ...

Asp.Net MVC Route Table and Controller Actions

I am creating a directory of sorts with members and their profiles. I'm using the MVC framework in .net. I have a view that allows you to find members based on some criteria so my controller has a Find() action result, then another that accepts the post verb. So, somesite.com/members/find displays the search tools, then once the form...

How to leave URL parameters unescaped in ASP.NET MVC?

I've noticed the returnurl URL parameter on the Stackoverflow login/logout links are not escaped but when I try to add path as a parameter to a route it gets escaped. So /login?returnurl=/questions/ask shows /login?returnurl=%2fquestions%2fask and it's kind of ugly. How do I get it to not escape the returnurl value? Here's what I'm do...

How should i make this ASP.NET MVC Route?

Hi folks, i wish to have the following url(s).. and i'm not sure how i should do the following: 1) Route registered in the global.asax 2) Controller method Urls/Routes - http://www.mysite.com/ - http://www.mysite.com/?page=2 - http://www.mysite.com/?tags=fooBar - http://www.mysite.com/?page=2&tags=fooBar Please note - i do not ...

How to use params with slashes with Sinatra ?

Playing with sinatra, I'm stuck on a little problem : when I use params with slashes, it confuses the router engine. So is there a nice way to handle this kind of param without having to encode it ? The code looks like get 'add/:url' do #.... end And I intend to get something like /add/http://sctackoverflow.com/ working ...

Rails nested resources

Here's the routes.rb: map.resources :assignments, :shallow => true do |assignment| assignment.resources :problems end How do i get the url to edit a problem (/assignments/xyz/problems/abc/edit), in code? I have tried both edit_assignment_problem_path(assignment,problem) and edit_problem_path(problem). While the firs...

How do I define RESTful routes in Rails for a resource which has multiple key fields?

My User model has the usual id primary key, but it also has a unique login which can be used as an identifier. Therefore, I would like to define routes so that users can be accessed either by id or by login. Ideally, the routes would be something like this: /users/:id (GET) => show (:id) /users/:id (PUT) => update (:id) ... /users/lo...

Rails Menus

I would like to know if there is a good plugin for rendering navigation links in Rails. It would be nice if it could render links to all possible GET actions on a controller directly from the routes file. ...

Pass website URL into the Route in ASP.NET MVC

I am working on a project that needs to grab the actual URL and use it in the route itself. Everything I am seeing, reading and testing allows the route to grab the items after the site URL. This is what I have tried and each time it simply say the site is blank (which is probably because of the default of blank). Can you throw me any...

How do I add custom options to ActionController::Routing::Routes map.resources ?

Hi All, there are several places in my routes.rb file where I say: map.resources :foo, :only => [:show, :index] and I would like to be able to say: map.resources :foo, :readonly => true ..or something of the like. I know this may seem kind of pointless, since it only saves a couple of characters, but I'd like to know how to do it ...

Routes.rb creating problem in rails

Hi Im using a link which is <%= link_to 'View User Group', {:controller=>:communities,:action=>:usergroups} , :class => "adminbutton viewusergrp" %> and routes contain the map.resources :vccommunities,:member => {:usergroups => :get} and some more action names are also specified here in member and collection. Im taking care of alphab...

Is there an ASP.NET MVC HtmlHelper for image links?

Possible Duplicate: ASP.NET MVC Ajax.ActionLink with Image The Html.RouteLink() HtmlHelper works great for text links. But what's the best way to link an image? ...

Stack Overflow Question Routing

If you review a SO question URL you will see that an ID and a "SLUG" are passed to the Questions controller: http://stackoverflow.com/questions/676934/what-do-you-need-to-write-your-own-blog-engine. What I find interesting is you can change the "SLUG" portion of the URL without affecting the application's ability to route the request exa...

Why is this MVC route not working?

Hi folks, here are two routes from my global.asax file. I'm trying to go to the second route and I'm getting a default 404 resource not found error. When i remove the first route (listed in this example), it works. How can i fix this, please? Snippet of global.asax code // GET: /user/PureKrome/Alert/69 routes.MapRoute( "User-Ale...

Rails Resource Restful Routes Helper functions and nil oject error

Hello I am getting an error when trying to use the resource route helper functions <%= link_to_remote "Delete", { :method => :delete, :url=> phone_numbers_url(phone_number_display.id), :update => "section_phone" }%> and in my routes i have map.resources :phone_numbers I get the following error You have a nil o...

Rails conditional routes

Hello I am trying to set up a user creation wizard where the user can only go to the page that corresponds to the current step in the wizard that the user is on. I have already sorted out the state machine functionality. The current state is stored in the DB. This is not the problem The problem is how to redirect the user to the right...

RouteTable.Routes RouteCollection?

The example I see everywhere for MVC-style routing is something like this: void Application_Start(object sender, EventArgs e) { RegisterRoutes(RouteTable.Routes); } public static void RegisterRoutes(RouteCollection routes) { routes.Add(new Route ( "Category/{action}/{categoryName}" , new CategoryRouteHand...

Help with Rails routes

Say if I have a controller, profile, which has just two actions. The first one is list, which will just show the list of names. I want these names to be links which will then take you to a page that shows the full profile. So I need a second action, view, which can then bed fed a parameter to indicate which profile to view. For example...