On Friday, November 16, 2012 8:18:04 AM UTC, Ruby-Forum.com User wrote:
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
Are school_1 and school_2 different models? If so, why?
I see they different controllers? Why?
Colin
i didn’t used model yet . As you see,above the site is partially static
, so i just been focused on views/ .
This is what my problem is and it is what i want to know. How did you
tackle
such situation ?
i didn’t used model yet . As you see,above the site is partially static
, so i just been focused on views/ .
This is what my problem is and it is what i want to know. How did you
tackle
such situation ?
I see they different controllers? Why?
if you have some idea , tell me .
What is wrong with the suggestion offered by Fred, which allows you
send them to the same controller but with params indicating which
school it is?
i didn’t used model yet . As you see,above the site is partially static
, so i just been focused on views/ .
This is what my problem is and it is what i want to know. How did you
tackle
such situation ?
I see they different controllers? Why?
if you have some idea , tell me .
What is wrong with the suggestion offered by Fred, which allows you
send them to the same controller but with params indicating which
school it is?
Colin
i didn’t said anything for his suggestion . but doesn’t fit my needs.
if all pages are static , isn’t better to use a gem like HighVoltage ?
it’s what I have been using when no need for CMS…
Le vendredi 16 novembre 2012 16:39:51 UTC+1, Colin L. a crit :
logic behind HighVoltage is not big.I rather construct with scratch as
per my needs.Moreover my pages are not fully static also.Anyway thanks
for
your suggestion .
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.