I created a model called LandingPage, and the current route looks something like this:
www.domain.com/landing_pages/1
Or something like that. I will have several of them, therefore destination_page, where id = 1 ... n.
However, when someone creates a landing page, I would like them to be able to define an attribute for the model, for example, "superbowl" to redirect to landing_page / 1, "nice" to landing_page / 2, etc.
This will allow the user to define the landing page as:
subdomian.domain.com/superbowl
who allowed
www.domain.com/landing_pages/1/
How should I do it? Each landing_page has a “shortname” attribute associated with its specific landing_page.
I'm on Rails 2.3.8. My hunch is in routes to scroll through available short words, but not sure.
8 def show
9
10 @landing_page = LandingPage.where(:name => params[:name]).first
11 redirect_to landing_page_path(@landing_page)
12
13
14 @redcloth_landing_page = RedCloth.new(@landing_page.message).to_html
15 form = "<div id='form'>" << @landing_page.form << "</div>"
16
17 @redcloth_landing_page.gsub!("{Form}",form)
18
19 render :layout => false
20 end