Hi,
I am making a call to a controller action in javascript using the getJson method. I need to pass two parameters to my action method on the controller, but I am struggling to do so. I do not fully understand the routing tables and not sure if this is what I need to use to get this working. Please see example below of what I am tr...
Hi,
Do/can routes in .net MVC look at subdomains?
i.e. subdomain1.example.com
...
I'd like this output:
<a href="\Catalog\Flooring">
<img src="http://site.com/dot.jpg" width="100px" height="100px" alt="" />
<span>Some text here</span>
</a>
using a RouteLink similar to:
<%= Html.RouteLink(myFPV.ProductTypeName, "CatalogType", new { controller = "Catalog", action = "Types", group = myFPV.ProductGroupName, ty...
I'm trying to write a helper method that accepts the name of a plural resource and returns a corresponding link. The essence of the method is:
def get_link(resource)
link_to "#{resource.capitalize}", resource_path
end
Clearly the resource_path part above doesn't work. What I'd like is to be able to pass foos to get foos_path and bar...
If I want to provide an alias for a controller, I can use map.resources :rants, :controller => 'blog_posts' yoursite.com/rants points to the blog_posts controller fine.
How do I give an alias to a nested resource, for example yoursite.com/users/5/rants ?
...
I have a model, target, that holds a number of records that are timestamped. On the corresponding controller, I list the months of those records by doing the following:
In models/target.rb
def month
self.recorded_on.strftime('%B')
end
In controllers/targets_controller.rb
@records = Target.find :all
In views/targets/index.html....
Hi,
I want to be able to give codes to potential users in the form of email links (e.g. mysite.com/signup?beta=rapunzel)
When someone clicks on the link, it populates a hidden_field with the value (will just using :params[:beta] work?)
Then before it creates the user it validates by checking against another table where I have differen...
Hi! How can I shorten the definition of my custom routes in Zend Framework? I currently have this as definition:
$route = new Zend_Controller_Router_Route(
":module/:id",
array(
"controller" => "index",
"action" => "index"
),
array("id" => "\d+")
);
self::$frontController->getRouter()->addRoute('shortcutOne', $route);
$route =...
In webforms, we would do somthing like this to set up a hander to generate a dyanmic image:
<img src="/barchart.aspx?width=1024&height=768&chartId=50" >
Then of course we would write code on the .aspx page to render the image using the parameters and write it back into the response.
I am honestly not sure how to set up/handle such a...
In ASP.NET MVC, I can get information on unit testing for routes and custom routes, but I can not figure out how to do unit testing for IgnoreRoute.
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
Practical code is much appreciated.
ASP.NET MVC Framework (Part 2): URL Routing
ASP.NET MVC Tip #13 – Unit Test Your Custom Routes
A...
I like all the default routes that are generated by Rail's map.resources. But, there are cases where I would like to use a non-numeric identifier in my routes. For example, If have a nested route consist of users and their articles, a standard route could be written as such:
map.resources :users, :has_many => [:articles] # => e.g. '/us...
In my routes.rb file I have a number of routes. I would like to know which one got matched for any request a user may have made.
For example, in routes.rb you have the following routes :
map.connect ":controller/:action"
map.connect ":controler/:action/:id"
and if I have a controller named a and an action named first, when a user g...
In a View, code like this will generate the right URL to jump to controller's action method based on the routes in your global.asax.cs file.
<%= Html.ActionLink("text", "action", "controller") %>
My question is how can I achieve a similar route-to-URL mapping outside a view, such as a Controller? There is no Html member on the Cont...
I have a series of URLs that look like
/Catalog/Ajax/Update/{ViewToUpdate}?var1=a&var2=b&var3=c
Currently I've setup several routes - one for each {ViewToUpdate} and what I'd like to do is pass the {ViewToUpdate} to my Action handler so I can condense my code. Instead of:
public ActionResult AjaxUpdateNavigation(string var1, string...
Trying to use this method (gist of which is use self.method_name in the FunnyHelper, then call it as FunnyHelper.method_name in the view).
However this causes at least a couple of problems - view methods like h() and named routes get broken (they're ok with the module method def method_name but not within any class method def self.metho...
Hi
I have a problem with reverse for regex routes, my config file is below:
routes.route1.type = "Zend_Controller_Router_Route_Regex"
routes.route1.route = "([^\,]+)([^p]*)(?:\,page_[0-9]+)?\.html"
routes.route1.defaults.controller = "index"
routes.route1.defaults.action = "find"
routes.route1.map.1 = "url_path"
routes.route1.map.2 = "u...
I have a list of actions on various controllers that are 'Admin' functions (create, update, delete) but other actions on those same controllers that aren't admin actions.
What I want to do is create a route that will prefix /Admin/ before all urls that call an action that have the Authorize filter attribute.
Is this even possible to do...
So my background is in Java web services, but I'm trying to make the move to ROR.
I'm using FlexImage to handle image uploading and thumbnail generation. I followed the guide and CRUD behavior was working fine at one point. However, at some point, CRUD behavior for one of my models (Images) was broken.
The error code I'm getting back...
How can I have lowercase, plus underscore if possible, routes in ASP.NET MVC? So that I would have /dinners/details/2 call DinnersController.Details(2) and, if possible, /dinners/more_details/2 call DinnersController.MoreDetails(2)?
All this while still using patterns like "{controller}/{action}/{id}".
...
<%= link_to 'Edit', edit_order_path(@order) %>
Is it possible to wire this link to the modify action of the Orders controller (instead of the edit action) without changing this syntax:
edit_order_path(@order)
...