routes

Pylons: Routes information availability from templates

Hi all, I'm building a Pylons application using evoque as our templating engine, though I think my question is relevant to other template engines. I have a base template that I'm using for our pages, and that base template does all the includes for CSS and Javascript files. I'd like to perform conditional test to include/exclude CSS and...

nested form_for singular resource

I have a singular nested resource like so: map.resources :bookings, :member => { :rate => :post } do |booking| booking.resource :review end Giving me these routes: new_booking_review GET /bookings/:booking_id/review/new(.:format) {:controller=>"reviews", :action=>"new"} edit_booking_review GET /bookings/:booki...

ASP.NET MVC Routing and Structure

I have a Customer list that will have Invoices and Emails linked to it. I have my customer/details/1 and customer/edit/1 working as per the default route but would like to have it instead be like below customer - Lists customers customer/1/edit - Edit Customer ID 1 customer/1/details - Details of Customer ID 1 customer/1/invoice...

Rails routing - custom routes for Resources

Hello guys, I'm building currently one Rails app and I'd like to stick to all those fancy things like REST and Resources, but I'd like to customise my routes a little. I want my GET route to be little more verbose - the app I'm creating is a simple blog, so instead of GET /posts/1 I'd prefer something like GET /posts/1-my-first-post. An...

username in url with rails routes

Hello, I'm not exactly sure how to frame this question so I'll just go for it. I am recently returning to rails after a hiatus and I am building a social networking style application. Basically I'd like to do what twitter does and have each persons profile page be found at "http://www.url.com/username" and while I have managed to get th...

How can I shared controller logic in ASP.NET MVC for 2 controllers, where they are overriden

Hello, I am trying to implement user-friendly URLS, while keeping the existing routes, and was able to do so using the ActionName tag on top of my controller (http://stackoverflow.com/questions/436866/can-you-overload-controller-methods-in-asp-net-mvc) I have 2 controllers: ActionName("UserFriendlyProjectIndex")] public ActionResult I...

Different routes but using the same controller for model subclasses in Rails

I have a Model Property which has subclasses using STI, and which I would like all to use the same controller with only different view partials depending on the subclass. Property Restaurant < Property Landmark < Property It works find except I'm not sure how to discern the subclass inside the controller to render the correct view. ...

Rails 2.3.5 Creating RESTful routes for a model named "Software"

Topic says it all guys, my program needs to be able to keep track of the "software" that belongs to a user, as such I have a MVC for "Software". However, I can't use RESTful routes at the moment since my plural and singular names are the same, it's "software" for both. Can anybody help me either, create new named routes or suggest a ne...

Rails, routing many named routes to one action

Is there a simpler way of writing this: map.old_site_cusom_packages '/customs_packages_options.html', :controller => :public, :action => :redirect_to_home map.old_corporate '/corporate.html', :controller => :public, :action => :redirect_to_home map.old_track '/track.html', :controller => :public, :action => :redirect_to_home map...

Rails Routes - How to make them case insensitive?

Routes in Ruby on Rails are case sensitive. It seems someone brought this up before, and it has been labeled will not fix. http://rails.lighthouseapp.com/projects/8994/tickets/393-routes-are-case-sensitive That strikes me as unfortunate, as I don't really see any upside on my own application for routes to be case sensitive, while on th...

Why did mislav-will_paginate start adding so much garbage to urls between rails 2.3.2 and 2.3.5?

I've used will_paginate in a number of projects now, but when I moved one of them to Rails 2.3.5, clicking on any of the pagination links (page number, next, prev, etc.,) went from getting nice URLs like this: http://foo.com/user/1/date/2005_01_31/phone/555-6161 to this: http://foo.com/?options[]=user&amp;options[]=date&amp;options[]...

ASP.NET MVC 2 RC 2 returns Area-specific controller when no area specified

I have a basic MVC 2 (RC2) site with one base-level controller ("Home"), and one area ("Admin") with one controller ("Abstract"). When i call http://website/Abstract - the Abstract controller in the Admin area gets called even though i haven't specified the Area in the URL. To make matters worse - it doesn't seem to know it's under Admin...

Editing multiple nested records simultaneously in Rails

I'm creating a simple quiz application where a question can have multiple answers. To improve the usability of my app, I want users to be able to edit ALL the answers for a given question in the same form: I found this great Railscast/Asciicast episode which does almost EXACTLY what I want to do http://asciicasts.com/episodes/198-edit-...

Nested routes in Rails with an alias

I have a primary model for my project, Place.rb with a places_controller, and I've currently got it exactly the way I want for the users end of my project. With a nested photos controller, review, etc. I want now to create a management resource which is mostly just an alias for Places, with its own nested resources, some of them overla...

How to add a new action in Ruby on Rails ?

Hello! I have this in routes.rb map.namespace :admin do |admin| admin.resources :projects, :has_many => :products end What I would like to is to be able to set the something in the routes.rb file in order for me to use new action in the products controller. Actions added by hand after scaffolding. I tried something like this m...

No action responding to my link

I have a simple web app with users and posts. I have an index controller and view that shows a list of the posts in the database. With the list, it shows a "Show" link which links to the specific post. I am trying to replicate that for users but something is going wrong. I have an index view that shows all the users in the database and ...

asp.net mvc master details and routing

I'm trying to model class and sections of a class and further instances of sections. so route should be Class/ (Create, Details, Index, Edit) for classes Then I've a section controller ClassSection so I would do Class/1/ClassSection/ (Create, ... ) since ClassSection without classid is useless and then further Class/1/ClassSecti...

What is the difference between _url and _path while using the routes in rails

When we define routes in routes.rb using the name like map.some_link we can use the link in two ways- some_link_url() some_link_path. What are the differences between the two? Which is more secure to be used? ...

Rails Route question

I want to setup a route so that if the user goes to http://mysite.com/page.html it is routed to the controller page_controller and the action index. How would I do this? ...

How to specify a route member inside a block in Rails?

The following code: map.resources :users, :has_many => :items Could be written like this in a block: map.resources :users do |user| user.resources :items end How could I write the following code in a block? map.resources :users, :member => { :start => :post } Also, where could I find documentation on writing routes in blocks?...