500 on clicking on Accounts tab
Reported by Evan Light | July 12th, 2010 @ 12:55 PM
Seeing this in the log:
SELECT sum("opportunities".amount) AS sum_amount FROM "opportunities" INNER JOIN "account_opportunities" ON "opportunities".id = "account_opportunities".opportunity_id WHERE ((((stage != "lost") AND (("account_opportunities".account_id = 6))) AND (("account_opportunities".account_id = 6))) AND (opportunities.deleted_at IS NULL OR opportunities.deleted_at > '2010-07-12 19:43:56.284651'))
Note that the 'stage != "lost"' doesn't source a particular table. That appears to be due to the named_scope in Opportunity here:
named_scope :not_lost, { :conditions => 'stage != "lost"'}
Comments and changes to this ticket
-
Mike Dvorkin July 12th, 2010 @ 08:14 PM
I don't see this happening -- checked with both MySQL 5.1.37 and SQLite 3.6.12. The 'stage' field is unique, so it gets resolved as 'opportunities.stage'.
What database are you running, Postgres? Can you attach a portion of log/development.log so I could see the actual error?
Thanks!
-
Mike Dvorkin July 12th, 2010 @ 08:30 PM
- State changed from new to resolved
(from [efbcb911c8b6c13a6049abd3aeccd1b6e0ff16da]) Named scope fix for Postgres/Heroku (thanks, Evan!) [#213 state:resolved] http://github.com/michaeldv/fat_free_crm/commit/efbcb911c8b6c13a604...
-
Mike Dvorkin July 12th, 2010 @ 08:31 PM
- State changed from resolved to new
Please let me know that fixes it. Thanks again!
-
Evan Light July 13th, 2010 @ 06:49 AM
No joy.
ActionView::TemplateError (PGError: ERROR: column "lost" does not exist
LINE 1: ...".opportunity_id WHERE ((((opportunities.stage != "lost") AN...^
: SELECT sum("opportunities".amount) AS sum_amount FROM "opportunities" INNER JOIN "account_opportunities" ON "opportunities".id = "account_opportunities".opportunity_id WHERE ((((opportunities.stage != "lost") AND (("account_opportunities".account_id = 7))) AND (("account_opportunities".account_id = 7))) AND (opportunities.deleted_at IS NULL OR opportunities.deleted_at > '2010-07-13 13:48:37.907874')) ) on line #1 of app/views/accounts/_account.html.haml: 1: - amount = account.opportunities.not_lost.sum(:amount)
2: %li[account]{ highlightable(dom_id(account, :tools)) }
3: - if amount != 0.0
4: .strip.some= number_to_currency(amount, :precision => 0) -
Elad Meidar July 22nd, 2010 @ 08:39 AM
Hi Kids,
We solved it here by changing a bit the named_scope on Oppertunity.rb#56
named_scope :not_lost, { :conditions => "opportunities.stage <> 'lost'"}
Changing the apostrophes and the not-equal made it work on heroku
-
Mike Dvorkin July 27th, 2010 @ 10:13 PM
- State changed from new to resolved
(from [a12dab73a52ea63a9de59dc72c641b885873fb00]) Fixed named scope condition syntax in the Opportunity model (thanks, Elad!) [#213 state:resolved] http://github.com/michaeldv/fat_free_crm/commit/a12dab73a52ea63a9de...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Ruby on Rails CRM platform for Web 2.0 and beyond
People watching this ticket
Tags
Referenced by
- 213 500 on clicking on Accounts tab (from [efbcb911c8b6c13a6049abd3aeccd1b6e0ff16da]) Named s...
- 213 500 on clicking on Accounts tab (from [a12dab73a52ea63a9de59dc72c641b885873fb00]) Fixed n...