Trotter Cashion on 6 Feb 2008 09:11:14 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PhillyOnRails] action aliases

  • From: Trotter Cashion <cashion@gmail.com>
  • To: talk@phillyonrails.org
  • Subject: Re: [PhillyOnRails] action aliases
  • Date: Wed, 6 Feb 2008 12:10:30 -0500
  • Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer; bh=oLT8ypf8/S2AZEUOgiBYy1Cr1ZYsDKeIQwaN1tbtppc=; b=U1DapOh6jyxsjozlT2DNH7OgAME7aD+T46D10Ls4seB8vBnGzWlXEPFV6UYbeuuYMtW7r0mEPBATQnHClimfo28E4JLKUiPe2HR4zFj1xhbapek0xKDNZ9kfEeRTYQTIuzAIK9VuHkqGDqaoj8sG3lYqLRad9zIWpR7mA6GfJ/M=
  • List-archive: <http://lists.phillyonrails.org/pipermail/talk>
  • Reply-to: talk@phillyonrails.org
  • Sender: talk-bounces@phillyonrails.org

Cliff's suggestion is better. Mine's pretty shoddy because it continues the use of the redirect, which initiates a whole new request.

- Trotter

On Feb 6, 2008, at 12:07 PM, Cliff Moon wrote:

Use routes. In your routes.rb file, you should add a line that looks like so:

map.connect '/mycontroller/add', :controller => 'mycontroller', :action => 'view'

Where mycontroller should be replaced with the name of your controller. And make sure to insert that above the default routes. You'll know the default routes because of the comment that describes them as such.

Chris Cera wrote:
Hi everyone, I have a simple question, but I can't seem to find the answer.
I want to make an 'add' action that is simply an alias for the
'view' action, where all params get passed without enumerating
that list of params.  This might be more of a Ruby question than
Rails.  A template is probably better, but now I'm just curious
how to pass the params over cleanly.

def add
   redirect_to(:action => 'view') # how to pass params?
end

Any help is appreciated.  Thanks, -Chris



_______________________________________________
To unsubscribe or change your settings, visit:
http://lists.phillyonrails.org/mailman/listinfo/talk

_______________________________________________
To unsubscribe or change your settings, visit:
http://lists.phillyonrails.org/mailman/listinfo/talk