In my application a user working at a dropzone can manipulate
transactions against customer accounts.  Here's my models:

class Transaction < ActiveRecord::Base
  belongs_to :account
end

class Account < ActiveRecord::Base
  belongs_to :dropzone
  has_many   :transactions
end

class Dropzone < ActiveRecord::Base
  has_many :transactions, :through => :accounts do
    def limited_to(transaction)
      scope = Transaction.scoped({ :conditions =>
['account.dropzone_id = ?', proxy_owner.id],
                                   :joins      => :account })
      scope
    end
  end
end

In a controller, I'd like to write:

current_dropzone.transactions.limited_to(@transaction)

but, I get the error:

      RuntimeError: ERROR       C42P01  Mmissing FROM-clause entry for
table "account"  P122    Fparse_relation.c       L2017
RwarnAutoRange: SELECT "transactions".* FROM "transactions"   INNER
JOIN "accounts" ON "accounts".id = "transactions".account_id  WHERE
(account.dropzone_id = 2)  (ActionView::TemplateError)

I've searched all over and tried many options but can't figure this
out, I hope someone can help.

Many thanks,
Bryan
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to