On Aug 22, 2011, at 8:13 AM, Surya wrote:
In my opinion you should let controller handle the size of your
list, if it is 'programs/1', 'programs/2' or 'programs/3' it will
look for :controller => programs, :action => your_defined_action .
So, in there in your action you just need to manipulate the
params[:id] and according to it generate your data. For e.g. -
if :id is 1 then generate your short_list, for 2 medium_list and for
3 long_list. Since, this all will be handle with in one action
defined with in a controller it will be very compact and DRY, and
can be viewed in a template. 3njoy :)
On Mon, Aug 22, 2011 at 5:33 PM, Erwin <yves_duf...@mac.com> wrote:
thanks , That's better than what I did first,
but is there any way to match to a specific name ( short_list,
medium_list, long_list ) based upon the parameter 1, 2, 3
I think you're asking about this:
match '/short_list' => "Programs#list", :list_id => 1, :as =>
'short_list'
match '/medium_list' => "Programs#list", :list_id => 2, :as =>
'medium_list'
match '/long_list' => "Programs#list", :list_id => 3, :as =>
'long_list'
The URL has the word and the controller gets a number as the parameter.
-Rob
Rob Biedenharn
r...@agileconsultingllc.com http://AgileConsultingLLC.com/
r...@gaslightsoftware.com http://GaslightSoftware.com/
On Aug 22, 1:12 pm, Surya <raj.sury...@gmail.com> wrote:
> try to make it like this:
>
> match "programs/:id" => "Programs#your_action_name", :as => :list
>
> So in your controller 'Programs' you are able to handle the
request with the
> "id" which will be variable, and the path can be called by
'list_path'. The
> action you'll call here will handle the request and you may then
list the
> rows accordingly.. :)
>
>
>
>
>
>
>
>
>
> On Mon, Aug 22, 2011 at 4:31 PM, Erwin <yves_duf...@mac.com> wrote:
> > I would like to have some more friendly URLS ...
>
> > I have some routes , with parameters I would like to rewrite but I
> > don't know if it's possible :
>
> > /programs?list=1 => /short_list
>
> > /programs?list=2 => /medium_list
>
> > /programs?list=3 => /long_list
>
> > thanks for your feedback
>
> > --
> > You received this message because you are subscribed to the
Google Groups
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-talk@googlegroups.com
.
> > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
>
> Please consider the environment before printing this email.
>
> Regards,
> Surya
--
You received this message because you are subscribed to the Google
Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-
t...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com
.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
.
--
Please consider the environment before printing this email.
Regards,
Surya
--
You received this message because you are subscribed to the Google
Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-
t...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com
.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
.
Rob Biedenharn http://agileconsultingllc.com
r...@agileconsultingllc.com
+1 513-295-4739
Skype: rob.biedenharn
--
You received this message because you are subscribed to the Google Groups "Ruby on
Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.