I can't seem to find a solution to what seems to me like a simple problem.
Sitemap.find(:all, :conditions => { :controller => 'sample', :action => '!index' })
Now obviously the ! in 'index' doesn't belong there, but I put it there to illustrate that I want any result EXCEPT 'index'. I've tried something like the line below but I've gotten server errors whenever I try it.
Sitemap.find(:all, :conditions => { :controller => 'sample',开发者_StackOverflow社区 "action <> 'index'" })
Use the array syntax for this:
Sitemap.all(:conditions => ["controller = ? AND action <> ?", 'sample', 'index']
Hash syntax is only useful if you're checking for equality.
精彩评论