Consider:
@channel = Channel.find_by_display_key(params[:id], :conditions => 'hidden=0')
What one would expect is that the finder sql constructed would be something like display_key=#{params[:id]} AND hidden=0. What actually happens though is the conditions generated by AR's method_missing handler are not merged with my supplied conditions, but instead AR allows my conditions to completely overwrite its own. See active_record/base.rb#method_missing. End result is that the first channel matching hidden=0 is returned, regardless of whether a channel with display key of params[:id] exists or what it is if it does.
If I read the documentation correctly what I'm trying to do should work:
ItâÂÂs even possible to use all the additional parameters to find. For example, the full interface for Payment.find_all_by_amount is actually Payment.find_all_by_amount(amount, options). And the full interface to Person.find_by_user_name is actually Person.find_by_user_name(user_name, options). So you could call Payment.find_all_by_amount(50, :order => "created_on").