Suppose I have a Book model, which contains many Page models.
The routing for this would be as so:
map.resources :books do |book|
book.resources :pages
end
Following the Rails default on this quickly leads to problems. Suppose Book #1 has 10 pages. The first Page in Book #2 will have this route:
/books/2/pages/11
This is a pre...
I just set up a database according to CakePHP's conventions, ran the "bake" scripts for models, controllers and views, and made sure the path was set up correctly.
When I go to the following style of URL:
http://BASEURL/app/controller_name
I get the expected list view for that controller, but all the links generated by baked pages ar...
I have a Rails app with a "Route" resource, and a "Route" controller (not to be confused w/ Rails routes). I've set it up so that the site admins (and only the admins) can manage the "Route" resource through the "Route" controller, while regular users manage their routes with a "Myroute" controller. I want both controllers to utilize R...
Consider an ASP.NET MVC 1.0 project using the Areas convention as described on this Nov. 2008 Phil Haack blog post. This solution works great once it's set up!
My trouble is starting thanks to my limited knowledge of ASP.NET MVC's routing rules.
My intention is to create an action method and URL structure like this:
http://mysite/...
I'm deploying an ASP.NET MVC site to a IIS6 webserver, so I'm using a default.aspx/{controller}/{action} style routing strategy.
However, for some reason it doesn't really work when using the default.aspx part. No matter the url, it always gets the default action (Index) on the default controller (Public).
I've been using the excellent...
Hi there,
I have an application here with a mix of webform and mvc. I specify the routing as below
routes.Add("AspxRoute", new Route("Upload/New", new WebFormRouteHandler<Page>("~/Uploads.aspx")));
routes.MapRoute(
"Default", // Route name
"{controlle...
if the user type
http://myweb/mysite.aspx (file does not exist)
I want them to go to
http://myweb/site.aspx (file does exist)
My goal is to make a bilingual website (including url) but without having to make physical file
this would be one file
http://myweb/acceuil.aspx
http://myweb/home.aspx
...
Relevant route registration code:
routes.MapRoute(
"QuestionsMostRecent",
"questions",
new { controller = "questions", action = "most_recent" }
);
routes.MapRoute(
"ControllerActionFormat",
"{controller}/{action}.{format}"
);
Route generation code:
Url.RouteUrl(new {
controller = "questions",
action = "most_recent"...
I scaffolded a test app and got a Routing error when I put an iFrame inside my view:
This is the show template where I added the iFrame:
views/bars/show.html.erb:
<p>
<b>Body:</b>
<%=h @bar.body %>
</p>
<iframe src=“http://www.yahoo.com” style=“width:500px; height:500px;” frameborder=“0?></iframe>
<%= link_to 'Edit', edit_bar_p...
Is it possible to define a route in the RouteCollection of Asp.net MVC, so that it just does the "URL rewriting" part and ignore the URL generation with Html.Actionlink(...)?
In fact I want to add a keyword between controller and action (controller/..keyword.../action) for certain very special requests. The generated URLs on the pages, ...
Let's say I have this:
<%= link_to "My Big Link", page_path(:id => 4) %>
And in my page.rb I want to show urls by their permalink so I use the standard:
def to_param
"#{id}-#{title.parameterize}"
end
Now when I click "My Big Link" it takes me to the correct page, but the url in the address bar does not display the desired pe...
Hello!
If I have a website at myFirstDomain.com/dir/, is it possible to get mySecondDomain.com to point to myFirstDomain.com/dir/ so that when users browse at the directed site, they only see mySecondDomain.com/potentialSubDirFromMyFirstDomain/ or how does it work?
...
I have a web app which relies on a number of back end services, and I would like to be able to dynamically switch between different instances of these services. So the thinking was to create an intermediate app which listens on some ports and redirects traffic as required.
If I was dealing with pure HTTP I would look at doing this with...
Hi Guys,
I am have started learning Rails, it was going good until now.
I am using HAML and have this on my index.haml
= submit_to_remote "submit_btn", "Create", :url => {:controller => "queries", :action => "create"}, :method => "post"
= submit_to_remote "exe_btn", "Execute", :url => {:controller => "queries", :action => "execute"},...
I am developing a http module that hooks into the FormsAuthentication Module through the Authenticate event.
While debugging i noticed that the module (and all other modules registered) gets hit every single time the client requests a resource (also when it requests images, stylesheets, javascript files (etc.)).
This happens both when r...
i am trying code given in Unix Network Programming by Richard Stevens. but i am not able to get the code to compile.
here is the source code.
http://www.cs.cmu.edu/afs/cs.cmu.edu/academic/class/15213-f00/unpv12e/libroute/
i don't have the header file net/if_dl.h and the net/route.h header file does not include the constants and structu...
Is there a good way of modifying a route based on the deployment type?
Basically, I have a route that has a :requirements => {:protocol => "https"}, and I'd like that to only happen in production, but not in development.
...
I have a website that uses Routes to do some URL rewriting. Note, I am not using MVC..just the Routes that make MVC famous :P
Anyways the site works completely well...and all is well
I enabled SSL on the entire site and accessing the site in https, I can get static files..I can access the aspx files directly...but the Routes no longer ...
I have a Rails app that's getting hit by ScanAlert calling /login.php, but the app is throwing a 500. I'd like to filter any format that's not supported by my site, and 404 instead.
My original inclination was to create a before_filter in application_controller.rb that removes any :format that's not :html, :xml, or :js, then render 404....
Hello all, is it possible to go to a different View without changing the URL? For example in my Index View, I have a link to go the the Details View but I would like to keep the URL the same.
Thank you very much,
Kenny.
...