The suggestion posted by fred is really well suited for your need.

for instance, if you go to 0.0.0.0:3000/fr/School1/abc

this will be routed to the #abc controller, but with param1='School1'

def abc
  @School=School.find_by_name(:param1)
  @[email protected]_by_name(action_name)
end

Now in your layout, you will have available @School, which has all the 
information about the school,
and @content, which contains the content of the page 'about us' etc etc.

If your content is static, this is not a good solution.

Au revoir,

Ace





On Friday, November 16, 2012 4:18:04 AM UTC-4, 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. 
>
> 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/-/MZgAeWc_2m0J.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to