I would take advantage of arel's method chaining and break down the
problem into smaller chunks.  Instead of using true scopes, I'd create
some useful class methods like so:

class Song < ActiveRecord::Base

  def self.published
    where(:published => true)
  end

  def self.approved
    where(:approved => true)
  end

end

Then in your controllers, call the class methods to match whatever
special conditions you need on your song collection (or none at all
in, admin's case):

songs_controller:
@songs = Song.published.approved

admin_controller:
@songs = Song.all

Related reading:
http://www.railway.at/2010/03/09/named-scopes-are-dead/
http://elabs.se/blog/24-scopes-are-obsolete

-- 
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