On Wed, Jul 25, 2012 at 3:32 PM, Michael Baldock <lists@ruby-forum.com> wrote:
> Hi, I've been stung when deploying a rails app to heroku, and I'm fairly
> confident the problem is the difference between my local db sqlite3, and
> the heroku standard free shared db which is postgres(i think).
Yes, it's PG.
> I have a scope in my model that looks like this
>
> scope :not_archived, :conditions => ['application_state != "archived"']
> This works fine locally, but in the Heroku logs it throws up the
> following error :
>
> ActionView::Template::Error (PG::Error: ERROR: column "archived" does
> not exist
> SELECT COUNT(*) FROM "coach_applications" WHERE
> "coach_applications"."user_id" = 10 AND (application_state !=
> "archived")):
>
> It's looking for a column archived, which is not what I want.
Notice the double quotes around the table name/column in the first
part? What happens if you change your scope to the form of
[ "application_state != 'archived' " ]
or
[ "application_state != ? ", "archived" ]
Untested, but PG is annoyingly (IMO) idiosyncratic at times.
HTH!
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment