I ended up creating one controller without a model. (rails g
controller staticpages)
I then created a layout file which imported the individual changes to
the layout, via a "yield" tied to a "content_for" in the view
files(static files(pages) in the "view of staticpages"(for example
abbreviations, aboutthissite etc etc).
The rest of the static file loaded with the usual "yield" to the
layout. Works a treat. No more updating the menu bar all done
automatically.
To get to the correct static file I created a route using:-

match 'static/:static_page_name'=> 'staticpages#show' (or in rails
2.x:-
map.connect 'static/:static_page_name', :controller=>
"staticpages", :action=> "show"

"static_page_name" variable accepted anything after "/static/" in the
url and passed it to the controller "staticpages" in which I set up a
show action containing:-

  def show
    @static_page_name = params[:static_page_name]
    allowed_pages = %w(abbreviations aboutthissite etc, etc,)
    if allowed_pages.include?(@static_page_name)
      render @static_page_name
    else
      redirect_to '/'                             #redirects to
homepage if link does not exists
    end
  end

I then only had to change the links in the website. (e.g.<%= link_to "
About This Site ", '/static/aboutthissite' %>)

and viola! its all working.

On Nov 26, 7:12 pm, Luis Saffie <[email protected]> wrote:
> Sounds to me that you need to use layouts for your application.
> By doing this, you need to only update one file and it'll be reflected
> everywhere on your site.
>
> L
>
> --www.saffie.ca
>
> --
> Posted viahttp://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].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to