Rails 3 Named Routes - Calling different actions in the controller dynamically as a parameter with the same named route


chorn
HOME ยป Web Design

Say i have a controller with index and doesn't have any other RESTful actions. I want to call different actions as a parametr from the same controller which has a named route as follows.


Example,


I have TargetsController and i should be able to call


targets_path(any_action, params)

Can i call


resources :targets do
get :action_name, :on => :member
end

on a controller that does not have the Restful actions


How do i write this in the routes.rb ? All the documentation i found did not talk about how the same r


Related to : Rails 3 Named Routes - Calling different actions in the controller dynamically as a parameter with the same named route
Rails 3 Named Routes - Calling different actions in the controller dynamically as a parameter with the same named route
by chorn in Web Design

Say i have a controller with index and doesn't have any other RESTful actions. I want to call different actions as a parametr from the same controller which has a named route as follows.


Example,


I have TargetsController and i should be able to call


targets
rails named routes + controller as parameter
by Belgium in Web Design

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


Calling a controller's action without a named route in Rails 3
by brtyler in Web Design

In Rails 3, is there a way to link to a controller's action using ajax without having a named route?


I tried <%= link_to 'Reload', '#', url_for(:action => :reload, :id => @user.id), :remote => true, :method => 'post' %>


but it returns with t


about rails' routes, adding collection routes to restful resources won't generate named route helpers?
by scosant in Web Design

namespace :admin do
resources :posts do
collection do
get 'whatever'
end
end
end

I was expect that will generate 'whatever_admin_posts_path' helper method, but it didn't.
It's there something wrong


rails routes confusing show action with named route
by LinnheCreative in Web Design

i have a problem implementing a list action with its own route. here is what i have
(just important parts)
routes.rb


map.resources :posts
map.login "login" ,:controller => "user_sessions" ,:action => "new"
map.logout "logout" , :controller
link_to project index possible with customized routes.rb and without a Named route in Rails?
by besn in Web Design

my routes.rb looks like this


map.resources :bookmarks
map.connect ':controller/:id/:action'
map.connect ':controller/:action'

so i can use urls like this


http://localhost:3000/bookmarks/Ruby/show

but when i try to l


Rails named routes using complex parameter names
by Vasiliy in Web Design

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


How to customize route to map url dynamically to a composed named controller in ASP.NET MVC3
by Shrek Qian in Web Design

I need to map URLs like this:


/stock/risk -->StockRiskController.Index()


/stock/risk/attr -->StockRiskController.Attr()


/srock/risk/chart -->StockRiskController.Chart()


...


/bo


How can I dynamically call the named route in a :partial in rails?
by ti22 in Web Design

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:


TAGS: dynamically call named route partial rails
Rails 3 - named route redirecting to wrong controller action
by bigben2wardpitt in Web Design

I'm fairly new to rails, but I have completed a couple of projects before, including the Michael Hartl Tutorial.
I'm building a simple app that stores a virtual wardrobe.
I've got 2 tables - users and items - where a user has_many items and an item belongs_to a user.
I set up the f


Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2014 © bighow.org All Rights Reserved .