For example, I have a named scope sfw_only
in my Image model that returns images with nsfw == false.
I'm also using acts_as_taggable_on_steroids
- and I'm trying to think of the most efficient way to do something like the following.
if !params[:tag].nil?
if nsfw_mode
@images = Image.find_tagged_with(params[:tag])
else
@images = Image.find_tagged_with(params[:tag])
... remove images with nsfw == true
end
else
if nsfw_mode
@images = Image.all
else
@images = Image.sfw_only
end