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

Category : 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.


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

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

View Replies

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

rails named routes + controller as parameter
Category : Programming Languages

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?

map.ride 'ride' ,:controller => {some-way-of-specifying-a-parameter}, :action => 'ride'

then at runtime, I

View Replies

Calling a controller's action without a named route in Rails 3
Category : Programming Languages

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

View Replies

about rails' routes, adding collection routes to restful resources won't generate named route helpers?
Category : Coding

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

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

View Replies

rails routes confusing show action with named route
Category : Programming Languages

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

map.resources :posts
map.login "login" ,:controller => "user_sessions" ,:action => "new"
map.logout "logout" , :controller

View Replies

link_to project index possible with customized routes.rb and without a Named route in Rails?
Category : Programming Languages

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


but when i try to l

View Replies

Rails named routes using complex parameter names
Category : Programming Languages

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


View Replies

Rails 3 - named route redirecting to wrong controller action
Category : Network & Servers

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

View Replies

How can I dynamically call the named route in a :partial in rails?
Category : Development Tools & Services

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:

View Replies

How to customize route to map url dynamically to a composed named controller in ASP.NET MVC3
Category : ASP & ASP.net

I need to map URLs like this:

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

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

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



View Replies

A route named 'Documents_default' is already in the route collection. Route names must be unique. Parameter name: name
Category : ASP & ASP.net

how can i resolve this error since i have two different projects with the same area but different namespace.

Line 15:         public override void
RegisterArea(AreaRegistrationContext context)Line 16:         {Line
17:             context.MapRoute(Line 18:            

View Replies

2012 / 2017 Copyrights BigHow , All Rights Reserved .