I have many instances of a Rails model, Post. When viewing an individual post, I'd like to create a form to create a child of Post called Comment. I'd like to prepopulate this form with a hidden tag that contains the post_id which is the foreign key in Comment.
The Railsy way to do this is to create a fancy-ish route such as:
/comment...
I'm trying to create a custom route like:search/result/city/p1/state/p2/zip/p3/min/p4/max/p5/bed/p6/bath/p7/cats/p8/dogs/p9/parking/p10 Where search is the controller and result the action p1-p10 are variables.
...
I have two strange problems when I use routing in a web form application. Environment: IIS 7.5; .NET 4.0 and Windows 7 64 bit.
default document does not work if I use (http://www.)mydomain.com. The exception message is "The controller for path '/' was not found or does not implement IController". However, if I debug in VS 2010 (http://...
For those wondering why Zend_Controller_Router_Route_Regex matches case-different routes, eg. hxxp://example.com/EN vs. hxxp://example.com/en, here's an explanation.
Zend_Controller_Router_Route_Regex is implicitly case insensitive. It is set in Zend_Controller_Router_Route_Regex::match() method. This is the piece of code that sets PCR...
I'm looking to make a really simple route in my ASP.NET MVC 2.0 website. I've been googling for help but all the examples I can find are for really complex routing.
Basically I want all the pages in my Home Controller to resolve after the domain as opposed to /Home/
For example I want http://www.MyWebsite.com/Home/LandingPage/
To bec...
I am attempting to use the MapPageRoute feature in Visual Studio 2010 and
.NET Framework 4.0 with a asp.net webforms application.
What I have noticed is that if I define a page route called "Default" like
below and the page Default.aspx exists in the project, then the route does
not work.
routes.MapPageRoute("Default", "defa...
I created the following route:
map.todo "todo/today",
:controller => "todo",
:action => "show_date"
Originally, the 'show_date' action and associated view would display all the activities associated for that day for all the Campaigns.
This ended up being very slow on the database...it would generate roughly ...
In Ruby on Rails,
http://localhost:3000/foobars/alt/1
works
but
http://localhost:3000/foobars/alt/1.xml
doesn't work.
config/route.rb is
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
so supposedly it supports an id.format in the URL?
...
In routes.rb
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
but then
http://localhost:3000/foobars/alt
will work too. The params are:
{"action"=>"alt", "controller"=>"foobars"}
so looks like :id is optional here. How can you tell it is optional vs not optional? Can you make it so that...
My path helpers (like data_path, users_path) are now translating itself to use '.' instead of '/'.
For example, data_path(@data) translates to:
data.%23<datareport:0x7fcaba0c2970>
instead of '/data/id'.
My routes look like:
map.resources :data
...
In Ruby on Rails, routes.rb, if we create a "named route"
map.something ":a/:b", :controller => 'foobar'
it will also create something_path and something_url which are two methods usable in the controller and in the view. Does map.connect create something like that too? Otherwise, isn't map.connect somewhat disadvantaged in this way?...
I'm working on upgrading my project from CakePHP 1.2 to 1.3. In the process, it seems that the "magic" routing for plugins by which a controller name (e.g.: "ForumsController") matching the plugin name (e.g.: "forums") no longer automatically routes to the root of the plugin URL (e.g.: "www.example.com/forums" pointing to plugin "forums...
Right now I'm building a project management app in rails, here is some background info:
Right now i have 2 models, one is User and the other one is Client. Clients and Users have a one-to-one relationship (client -> has_one and user -> belongs_to which means that the foreign key it's in the users table)
So what I'm trying to do it's on...
I'm writing an app where several of the routes should only be accessible from localhost. It looks like this is possible with the new routing system.
http://www.railsdispatch.com/posts/rails-3-makes-life-better
This has examples of restricting routes based on IP address, and setting up an IP address blacklist for your routes, but I'm in...
Hi!
New to Kohana... I was wondering if it's possible to use regex for setting up a route that handles all requests except for one, 'main_page' for example?
Thanks for your time
...
I have a AR model inside a module
class Long::Module::Path::Model < ActiveRecord::Base
end
and want to use following routes (without the module names, because it's easier to write and remember)
resources :models
buts Rails 3 always wants to use a URL like
long_module_path_model_url
Is there are way to change this behavior?
Hope...
I'm a little new to rails sorry if this seems basic
Alright so here's the deal I'm creating an application that will have many users and all the users have many songs. However when I try to create a song I get the following error:No action responded to 1. Actions: create and new and my browser is at the url: http://0.0.0.0:3000/users/1/...
I'm trying to have specific folders for each language in Views. (I know this isn't the best way of doing it but it has to be this way for now)
e.g.
/Views/EN/User/Edit.aspx
/Views/US/User/Edit.aspx
These would both use the same controller and model but have different Views for each language.
In my Global.asax.cs I have
routes.Map...
This seems like a fairly simple problem to me but I have been having some issues.
In one of my views I use something like
<% if current_page?(:controller => "activities", :action => "new") %>
*Do something here*
<% end %>
and it does something specific on the new page for a form. Easy enough and it works great.
Unfortunate...
In Ruby on Rails, how can I do the equivalent of this in a more elegant routes line? I may have to add many of these...
map.connect '/about', :controller => "site", :action => "about"
map.connect '/contact', :controller => "site", :action => "contact"
map.connect '/preview', :controller => "site", :action => "preview"
Thanks!
...