Hi I have a strange problem which I'm hoping someone might be able to
shed some light on.

I have a Rails app with two (relevant) classes:

class Category < ActiveRecord::Base

  has_many :businesses
  has_and_belongs_to_many :features, :order => "Name"

end

and

class Feature < ActiveRecord::Base

  has_and_belongs_to_many :businesses
  has_and_belongs_to_many :categories

end

In my app I have a view that shows the relevant features for the
selected category. I want those features to be sorted alphabetically.

When I run this app on the desktop it works fine, but when I upload to
Heroku and run it there I get an exception on the 'order by':

2011-02-27T20:16:38-08:00 app[web.1]: Processing
BusinessesController#edit (for 210.215.89.66 at 2011-02-27 20:16:38)
[GET]
2011-02-27T20:16:38-08:00 app[web.1]:   Parameters: {"id"=>"1"}
2011-02-27T20:16:38-08:00 app[web.1]: Rendering template within
layouts/businesses
2011-02-27T20:16:38-08:00 app[web.1]: Rendering businesses/edit
2011-02-27T20:16:38-08:00 app[web.1]:
2011-02-27T20:16:38-08:00 app[web.1]: ActionView::TemplateError
(PGError: ERROR:  column "name" does not exist
2011-02-27T20:16:38-08:00 app[web.1]: LINE
1: ..."categories_features".category_id = 221 )  ORDER BY Name ASC
2011-02-27T20:16:38-08:00 app[web.
1]:                                                                ^
2011-02-27T20:16:38-08:00 app[web.1]: : SELECT * FROM "features"
INNER JOIN "categories_features" ON "features".id =
"categories_features".feature_id WHERE
("categories_features".category_id = 221 )  ORDER BY Name ASC) on line
#77 of app/views/businesses/edit.html.erb:
2011-02-27T20:16:38-08:00 app[web.1]: 74:    end %>
2011-02-27T20:16:38-08:00 app[web.1]: 75:
2011-02-27T20:16:38-08:00 app[web.1]: 76:   <div id="feature_options">
2011-02-27T20:16:38-08:00 app[web.1]: 77:     <%= render(:partial =>
"categories/supported_feature", :collection => @feature_options) %>
2011-02-27T20:16:38-08:00 app[web.1]: 78:   </div>
2011-02-27T20:16:38-08:00 app[web.1]: 79:
2011-02-27T20:16:38-08:00 app[web.1]: 80:   <p>

Since it works locally but not on Heroku, I'm suspecting some
difference related to Postgres as I'm using SQLlite on the desktop.

Is there anything special I need to do to make this work on Heroku?

Hoping someone can help.

Cheers,

Pete

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to