Current state:
A router is loaded from xml file
two route name within the router are going to the same controller and action, for example: www-language-employee and www-language-trainer are going to the same controller and action --> EmployeeController & listemployeeAction
Problem:
- Need to know which route name is dispatched/being ...
In my routes.rb I've got:
map.connect ':name',
:controller => 'my_classes',
:action => 'show'
And that works perfectly, so a url like this sends params like so:
http://localhost:30000/awesome
Parameters: {"name"=>"awesome"}
But if I have something like this I get this error:
http://localhost:30000/weak.sauc...
Is it possible to generate the url for the form submit based off of the values in the form? I am trying to create a search form that asks for the make and model
<% form_tag make_model_search_path(:client_id => @client.id) do %>
<%= select_tag :make, options_for_select(make_list) %>
<%= select_tag :model, options_for_select(model_list) %...
I am trying to calculate a route based based on either geographic location or address. I figured the obvious way would be to use some part of the built-in Google Maps package, but it proved harder than assumed. There used to be a package called com.google.googlenav, but from that disappeared with the 1.0 release of the Android SDK.
I kn...
Hi
Normally my URLs look like the standard: www.example.com/controller/action
Now I want to setup my administration section like:
www.example.com/admin/
www.example.com/admin/user/list
www.example.com/admin/content/add
etc.
So the format is: www.example.com/admin/controller/action
I can't seem to figure out how to setup the ro...
I want to cycle through each page of a paginated model's index. I'm using jquery to cycle through the pages. I find the link_to expression is calling the create action when called by jquery. The link_to expressions calls the index action under any other circumstances.
For instance:
<div id="links">
<% 1.upto(@total_pages) do |numb...
I'm having an issue with my routes and the name of the path it generates. Or I'm naming it wrong in the view or something... not totally sure. My relationships in my models are as follows:
class Client < ActiveRecord::Base
has_many :users
has_many :elements, :through => :users
end
class Element < ActiveRecord::Base
belongs_to :u...
My first route:
// Should work for /Admin, /Admin/Index, /Admin/listArticles
routes.MapRoute(
"Admin", // Route name
"Admin/{action}", // URL with parameters
new { controller = "Admin", action = "Index" } // Parameter defaults
);
is not re...
Hi,
I have a route where I want to set a constraint on the "action" paramter. It has to be either "Car" or "Boat"
...
I'm trying to create a nested resource with a url scheme along the lines of: "http://example.com/username/...".
What I currently have is this:
ActionController::Routing::Routes.draw do |map|
map.home '/', :controller => 'home'
map.resource :session
map.resources :users, :has_many => :nodes
#map.user '/:id', :co...
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...
What I'm trying to do:
I'm building a system where there are different types of post. Setting aside the models, this question is about the routes and the controller
Basically /posts/new should go to an index page of sorts, while /posts/new/anything should look up the type anything and then build a form for creating a new one.
How I'm...
Problem: I have a large collection of points. Each of these points has a list with references to other points with the distance between them already calculated and stored. I need to determine the shortest route that begins from an origin and passes through a specific number of points to any destination.
Ex: I'm on vacation and I'm st...
I am constructing a table of routes in my Pylons app. I can't get redirect() to work the way that it should work. I'm not sure what I'm doing wrong.
Here is an example of redirect() usage from the Routes documentation:
map.redirect("/home/index", "/", _redirect_code="301 Moved Permanently")
Here is what appears in my routing.py f...
As my understanding on nested resources, on edge Rails, should not
link_to 'User posts', @user.posts
point to
/users/:id/posts
?
The routes.rb file contains
map.resources :users, :has_many => :posts
If this is not the default behavior, can it be accomplished doing something else?
...
I need to create a pretty route for an action that is expecting ugly nested parameter names (this is set and not something I can change at this time).
So instead of
http://domain.com/programs/search?program[type]=leader&program[leader_id]=12345
I want
http://domain.com/programs/search/leader/12345
The problem is that Rails rou...
for example you have custom route like this:
CustomerOrder/{action}/{id}/customerid={customerid}
the url became like this:
CustomerOrder/Create/customerid=1
how can you get the customerid and use it in the view?
<%= Html.MenuItem("Back to List", "Index", new { customerID = ???????? })%>
...
I'm having troubling completing a task the RESTful way. I have a "tasks" controller, and also a "complete_tasks" controller.
I have this in the complete_tasks_controller create action:
def create
@task = Task.find(params[:id])
@task.completed_at = Time.now
@task.save
end
I tried calling this:
<%=link_to "Complete task", new...
Hi. I'm using a paperclip plugin with an extension to write to the database. The default looks like: /screenshots/photos/24?style=thumb which gets caught already by the default routing in routes.rb.
I want to set it to :url =>':relative_root/:class/:attachment/:id/:style/:basename.:extension' (This produces URLs that I like on the pag...
I have a route in my code that looks like this:
map.app 'applications/:title_header', :controller => 'apps', :action => 'show'
I also changed my show method in the controller to be like this:
@app = App.find_by_title_header(params[:title_header])
If I type in applications/title things work fine. If I type in applications/1 (valid I...