On Friday, November 16, 2012 8:18:04 AM UTC, Ruby-Forum.com User wrote:
>
> Hi, 
> I unable to follow DRY principle. I struck in situation where actions 
> are same but controller are different.Wait,let me explain you with 
> example . 
>
> http://www.example.com/en/xyz/abc 
> http://www.example.com/en/mnb/abc 
> http://www.example.com/en/xkj/abc 
> http://www.example.com/en/cbc/abc 
>
> As you see in above URLs second last parameter is changing every time . 
> How to tackle such situation. 
>
>
It's hard to say when I don't knwo what you're doing in those controllers 
but if they're the same and it's just the routing you're asking about you 
could have a route such as

match '/en/:param1/abc', :to => 'foo#index'

which would route all those urls to the index action of your foo 
controller, setting params[:param1] appropriately
 
Fred

Currently i thought to use scope method in config/route.rb or i will 
> create separate controller for each /xyz/ , /mnb/ , /xkj/ . 
>
> How do you solve such problem ? It will be good if you tell me way which 
> follow DRY and flexible too. 
>
> Thanks. 
>
> -- 
> Posted via http://www.ruby-forum.com/. 
>

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/S1SLm2MdLz8J.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to