Jeremy
2008-Mar-17 03:09 UTC
find(:all) that works when called by regular view but not rss builder
I have an index page that displays the newest contents of a table
called ratings. The controller code looks like this:
1. def index
2. @newest_ratings = Rating.find(:all, :order => "twitter_num
DESC", :limit => 20)
3.
4. # . . . some other code . . .
5.
6. respond_to do |format|
7. format.html
8. format.rss {render :layout => false}
9. end
10. end
This works when I load index.html.erb, but when I try to load
index.rss.builder, it just downloads an error page instead of an rss
feed. When I check the log, this is the error:
ActiveRecord::StatementInvalid (Mysql::Error: Table
''twitterate.ratings'' doesn''t exist: SELECT * FROM
`ratings` ORDER
BY twitter_num DESC LIMIT 20):
This doesn''t make sense to me; how can it not realize that the table
exists when it queries from it just fine when the same controller code
is called from the other view template? To make it even weirder, I
have a nearly identical setup with the ''show'' method (does the
same
thing but for a single user) and it works fine when generating the rss.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---