I have a number of .js files that I would like to be stored in the same directories as their views (they're specific to a view - its simply to keep the javascript separate from the view's HTML)
However, adding them to the /Views/ControllerName/ directory wont work because when a request is made to the webserver for the .js file:
<scrip...
Hi Everyone,
I have created a custom action within one of my controllers as follows:
# GET /kases/discharge/1
# GET /kases/discharge/1.xml
def discharge
@kase = Kase.find_by_jobno(params[:id])
respond_to do |format|
format.html { } # discharge.html.erb
format.xml { render :xml => @kase }
format.pdf { ...
I want to set a route :requirements on an array that verifies a particular parameter is included in an array:
atypes = [:culture, :personality, :communication]
map.with_options(:path_prefix => ':atype',
:requirements => {:atype => atypes.include?(:atype)}) do |assessment|
...
end
I haven't been able to find any documentat...
In my Rails app I have a fairly standard has_many relationship between two entities. A Foo has zero or more Bars; a Bar belongs to exactly one Foo. Both Foo and Bar are identified by a single integer ID value. These values are unique across all of their respective instances.
Bar is existence dependent on Foo: it makes no sense to have a...
Hi all,
I wanted to create a simple paginated search for my project. I'm having trouble with my 'advanced search' page, where I have several textbox inputs that the user would fill with the appropriate data (basically just several filters).
My view is strongly-typed with the paginatedList class similar to the NerdDinner tutorial.
In m...
I know this isn't RESTful, but for now, I'm trying to set up an api/v1 controller. Ideally I would like to call it like this:
site.com/api/v1/verify.xml
But right now I can't get the .xml to work. I have the following route so far:
map.namespace :api do |api|
api.connect ':controller/:action/:id'
end
I can do /api/v1/verify but...
I have multiple controllers with different actions (no "Index" actions). The actions I consider "default" actions, are named differently. I want to create default routes for their names and have the first available action (from my list of default actions) executed if only the controller name is provided in the route.
So, for example, I ...
I created a new action called "asked". asked.haml is in views/questions as it should be. I've also added
def asked
respond_to do |format|
format.html
format.xml { render :xml => @questions }
end
end
to the Questions controller for this action.
My problem is that when I got to the url http://localhost:3000/q...
Hi,
is it possible to have the controller value in a rails named route as a parameter, which I can pass at runtime to direct the call to the proper controller?
e.g.
map.ride 'ride' ,:controller => {some-way-of-specifying-a-parameter}, :action => 'ride'
then at runtime, I want to pass the controller name to which this call should be goi...
In Haml, I've been trying to get the following link_to_remote call to work. It's called from the /questions/new view.
#{link_to_remote image_tag('x.png'), :url => {:controller => 'questions', :action => 'remove_tag_from_cart'}}
I've tried the following variations.
#{link_to_remote image_tag('x.png'), :url => {:controller => :question...
My website uses categories and sub-categories.
I'd like the follow mapping:
/Category/Fruit
/Category/Fruit/Apples
But if I use the below:
routes.MapRoute(
"Category", // Route name
"Category/{category}/{subcategory}", // URL with parameters
new { controller = "Entity", action = "Category" } /...
How do I add a custom route for a new resource in the Rails 3 routes?
I know how to do it for collections and members but this style doesn't seem to be working for new resources. Is this a bug or am I doing something wrong?
So these work:
collection do
get :wish
end
member do
get :wish
end
But this doesn't work:
new do
get ...
Let's say I have this Controller:
public class GlobalizationController : Controller
{
public JavaScriptResult GlobalizedLabels(string virtualPath)
{
return new JavaScriptResult();
}
}
I want the controller to handle (i.e. invoke from) any of the relative URLs below:
/globalization/~Enlargement/Controls/Container....
I have log in functionality that will check for a session, if it not there the user will be redirected via Request::instance()->redirect('managers/error/1');
In the error action in the managers controller I can't get the value 1 which represents a specific error msg.
How can I capture the value "1" from the url, I'm only using standard ...
I have the following partial. It can be called from three different times in a view as follows:
<%= render :partial => "contact_event",
:collection => @contacts,
:locals => {:event => email} %>
Second time:
<%= render :partial => "contact_event",
:collection => @contacts,
:locals => {:event => call} %>
...
<routes>
<www type="Zend_Controller_Router_Route_Hostname">
<route>www.domain.com</route>
<chains>
<index type="Zend_Controller_Router_Route">
<route></route>
<defaults module="default" controller="index" action="index" />
</index>
<community>
...
How can that be done? Thanks
...
Update: Turns out that this problem was because half my mongrel did not restart. Thanks all for help!
Hi folks, i have an urgent problem. Essentially, my routing works on my localhost. But when i deployed this to production, the routes does not seem to work correctly.
For example, given a new route "/invites" - sometimes i will get a 4...
This is how I'm doing it now:
link_to "Profile", :controller => "profiles", :action => "asked", :id => @profile
# => <a href="/profiles/asked/1">Profile</a>
Does it make more sense for the URL to be <a href="/profiles/1/asked">Profile</a>? Profile 1 asked some number of questions, so it makes more sense to me for the URL to look like...
Possible duplicate: Google Maps: Given a point, how to find all points at a given road distance?
I am not overly familiar with the maps API but wanted to get a feel for whether or not this scenario is possible.
I am interested in creating a route generator based on given distance.
Select a start location that also acts as finish l...