routes

Routing with sub domains

I have an MVC website which has 3 main components Member area which has the path /Member/{controller}/{action}/{id} Individual pages which will respond to any subdomain, e.g. user1.example.com/{controller}/{action}/{id}, user2.example.com/{controller}/{action}/{id} Main website which will respond to any url under www.example.com/{contr...

Routes only want a show on default despite explicit member statement

When I go to .. www.website.com/admin/organizations/org_deals , I get : Missing template admin/organizations/show.erb in view path My routes.rb : map.namespace :admin do |admin| admin.napespace :organizations do |organization| organization.org_deals 'org_deals', :action => 'org_deals', :member => {org_deals => :get} end end ...

Rails route with N number of parameters

Hi All, I have application which allow users to create there on URL for a page on a particular domain. What I want to achieve is to create URL having variable number of parameters separated by "/". For example: www.mydomain.com/a ww.mydomain.com/a/b www.mydomain.com/a/b/c and so on. After the root, everything would be considered as...

No response to Show and Rails Routes

I have my file structure set up appropriately ( I think ! ) , and claims nothing responds to show. My file structure : views/admin/admin_wysi/index.html.haml My controller ( controllers/admin/admin_wysis_controller.rb ) class Admin::AdminWysisController < Admin::ApplicationController def index end end My routes.rb map.name...

Rails scaffolding from scratch has its drawbacks..

1st Question: I'm trying to make the create method work, but it appears that my form is sending data innapropriately to my DB. This is the server.log : Processing Admin::AdminWysisController#create (for ::1 at 2010-06-22 13:43:58) [POST] Parameters: {"commit"=>"save", "action"=>"create", "authenticity_token"=>"P8pW7GnSNr7RZcxFcejpfsu9Y...

Routing in Rails 3: Map with options?

I can't seem to find documentation on mapping routes with options in rails 3. As a specific example, I need to translate map.with_options :controller => 'users' do |signup| signup.signup '/signup', :action => 'landing', :conditions => { :method => :get } signup.premium '/signup/premium', :action => 'new', ...

Issue with RouteValueDictionary and RedirectToRouteResult

I have created the following RedirectToRouteResult: new RedirectToRouteResult(new RouteValueDictionary{ { "controller", "Login" }, { "action", "Failed" }, { "ReturnUrl", filterContext.HttpContext.Request.Url.PathAndQuery } }); This fails to find the specified ...

Using rails resources (REST), how can I use a form to filter results on GET requests (i.e. /products)

Hello, I'm new to rails and having trouble figuring out how to do this RESTfully. I have a route set as map.resources :products and what I want to do is have some way to filter the results returned from the index action. For example, you go to /products which calls the index action per the resources default, then on that page there is a...

Using Special Symbols in ASP.NET MVC Routes

Hello! I want to use the url such as "/ControllerName/ActionName/Id" Id - only digits or null. But when I use regular expression in MapRoute, "\d{1,4}", I see the exception - error404 page, when I'm trying to see /ControllerName/ActionName/" page. Also, I don't know, how I can catch exception with special symbol - ". Please, help.Thanx....

In Rails Routes redirect /:controller_name to root?

I have a root path in my routes file: map.root :controller => 'games', :action => 'index' The problem is that if anyone goes to: http://domain.com/games it doesn't show the root, thus we're creating two urls for the same page. Is there a way to change any hit to http://domain.com/games to http://domain.com ? I'd rather not fiddle arou...

Rails: Mapping Conflicting Routes by Detecting Param

Hey! I am trying to set up routes in a Rails application so that, depending on the type of parameter passed, Rails sends the request to a different action. I have courses which have an attribute state which is a string with a two letter state abbreviation. When a user visits /courses/1, I want Rails to display the show action in the co...

ASP.Net 4.0 - How to access RouteData from within an ASHX?

My web site has a handler (FileDownload.ashx) that deals with all file download requests. I've recently migrated my site to ASP.Net 4.0, and it now uses routing extensively. Everything works fine when dealing with page requests (aspx), but it's not working with my handler - I encounter the following error: Type '<snip>.Handlers.FileDown...

Rails 2 Namespace and Shallow Routes Issue

Hello. I've written the admin area of a particular rails app and now I'm ready to set it as own section within the website. Therefore, it will be /admin However, I didn't want to have it as /admin within the route itself I wanted to have something less common, so I added a couple of hyphens before and after it. So the route is /-admi...

Routing: 'admin' => true vs 'prefix' => 'admin in CakePHP

Hi I'm setting up admin routing in CakePHP. This is my current route: Router::connect('/admin/:controller/:action/*', array('admin' => true, 'prefix' => 'admin', 'controller' => 'pages', 'action' => 'display', 'home')); It works fine, but I don't understand what the difference between 'admin' => true, and 'prefix' => 'admin' is. Whe...

CakePhp Routes & Session Variables

Is there an intrinsic reason why I can't, in routes.php, route a user based on the contents of a session variable? e.g. Router::connect('/dashboard', array('controller'=>'users','action'=>'dash',1) ); works okay, but, replacing the 1 with $_SESSION['userid'] doesn't. Am I missing something important about session variables here?...

Scaffolding does not create Routes.rb entry.

When using scaffolding in Ruby on Rails to build my controller, the scaffold is not adding a map.resource to the routes.rb file. I am having to do this manually to get the view to work. I'm merely following the blog demo they have you create in the tutorial so I'm not doing anything fancy. Shouldn't the scaffold be adding this automati...

does url_for use to_param when building route

I'm having trouble getting url_for to render take to_param into account when choosing which route to use. I have two sets of routes that use the same model (Foo). If Foo.is_special, the url should map to /special/:action. If it isn't, it should map to /:id/:action. Because it's the same model, I'd like url_for to automatically know whic...

Better solution than accessing routes in the Model?

So I know that you shouldn't use UrlWriter methods in a model, but I wasn't sure what a better way to handle my current situation is. Basically, I want to allow a User to post something to his facebook feed, and want to write a post_to_fb_feed(object) method in class User. Now, the URL of what is actually posted depends on the object, s...

Cakephp localization routes

Hi, My localization files (.po) work if I change the default language, but I can't make the routes working, here's what I've got atm: Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); Router::connect('/login/*', array('controller' => 'users', 'action' => 'login')); Router::connect('/logout/*', array('co...

Rails routes and site performance

Is there a direct correlation on site speed with the number of namespaces / routes in the routes.rb file of a Rails Application? I am handling a fairly large application with more than 30 disparate models/entities and most of these resources have their own routes. ...