custom-routes

Rails can't find my route but it exists!

Ok I have events that I want to publish/unpublish with an extra action (nonRESTful) I watched Ryan Bates' railscast on this: http://railscasts.com/episodes/35-custom-rest-actions and it got me most of the way. I think the problem is that my route is nested in an /admin section so even though when I run rake routes and get: publish_admin...

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 ...

Protecting images in ASP.NET MVC (w/ custom RouteHandler)

I created a custom RouteHandler for images that I want protected. My RouteHandler simply takes a new route (graphics/{filename}) and does a lookup for the true file path, sets the mime type, and serves it up. That works fine. (http://www.mikesdotnetting.com/Article/126/ASP.NET-MVC-Prevent-Image-Leeching-with-a-Custom-RouteHandler) Wh...

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...

Problem with custom routes

I'm using the following route routes.MapRoute( "PatientList", "User/{SearchName}/{LocationID}/{Page}", new { controller = "User", action = "Index", SearchName = "", LocationID = 0, Page = 1 } ); It fails on the following URL: /user//1/1 Can anyone tell me what I'm doing wrong? ...

How do I write a route that is SEO friendly in rails?

I am changing my site over from Google App Engine to rails and I would like to keep my place in google search. Currently my site uses a URL /page?pid=microsoft-interview-questions to access the Microsoft subsection of interview questions. How would I create a route that can send this to '/tags/:id' where :id would be microsoft in this ca...

Using friendly_id in a catch all route

Hi all, I want to be able to use friendly_id in a catch all route to render the page that it fetches. for example http://localhost:3000/business would render controller "pages" action"show" with id "business" without leaving the url above. The aim of this is to avoid things like localhost:3000/pages/business and make shorter urls. I ...

How do I set up a named route in rails 3?

This is a month long thing I've been putting off, and I can't for the life of me figure this bugger out. I'm tracking to access a file in website/admin/organizations/org_deals My routes look like this : map.namespace :admin do |admin| admin.namespace :organizations do |organization| organization.org_deals 'org_deals', :action =>...

[model]_path generator for named route adding parameters in [model] view

Hallo I have a named route: map.notes '/notes/:id/:from_date/:to_date', :controller => "users", :action => "notes", :defaults => { :from_date => nil, :to_date => nil } When I create a path for this route in any other model or when using the route without the additional parameters (/notes/1) i get the expected url generated: notes_pa...