Thanks to all, settled on this code in the end in case useful to anyone 
else - further tips appreciated, works great though.

class ApplicationController < ActionController::Base

  before_filter :grab_banner

  def grab_banner
    banner = BannerAdvert.first(:conditions => [ "published >= ?", 1], 
:order => "RAND()")
    if banner
      @banner_url = banner.url
    end
  end

end



I realised "lightening bolt", that for many thing I don't actually NEED 
an admin interface/scaffold - like in this case I just created a 
BannerAdvert model and I CRUD the records directly with Sequel Pro. 
Anyone comment on this approach - saves me hours and keeps the app 
clean. Silly, simple tip - no more scaffolded code - except when it 
helps me - feels like coming on to the next stage.. :-).
-- 
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].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to