Hey everyone, I have been working on a project that incorporates plutus and I am not attempting to switch multi-tenancy on. I ran the generated and ran the migration, now I have tenant_id on the plutus_accounts table, and I added the initializer. I am trying to use the Organization model in my project as the Tenant by specifying config.tenant_class = 'Organization'. here are my plutus associations on my Organization model:
class Organization < ActiveRecord::Base
has_many :entries, :class_name => 'Plutus::Entry'
has_many :accounts, :class_name => 'Plutus::Account'
has_many :assets, :class_name => 'Plutus::Asset'
has_many :liabilities, :class_name => 'Plutus::Liability'
has_many :equities, :class_name => 'Plutus::Equity'
has_many :revenues, :class_name => 'Plutus::Revenue'
has_many :expenses, :class_name => 'Plutus::Expense'
These associations worked before adding multi tenancy, but I was literally coping the source code for the Plutus models into my project under a plutus folder and adding associations to them and their tables. My goal is to incorporate multi tenacy the proper way, but when I enable multi tenacny through plutus I get:
NoMethodError: undefined method `val' for #<Arel::Nodes::BindParam:0x007fa1dc974cf0>
I would also like to override the Amount class so I can add a belongs_to the Relationship model from my project and I am assuming I will need to do the same with Plutus Entry to enforce the association above "has_many :entries, :class_name => 'Plutus::Entry'". Can anyone assist on the proper way to incorporate this behavior into my project?
thanks for any assistance you can provide, and for the gem.
here is my current schema for the models involved:
create_table "plutus_accounts", force: :cascade do |t|
t.string "name"
t.string "type"
t.boolean "contra"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "number"
t.string "h2"
t.string "h3"
t.string "parent"
t.string "description"
t.integer "tenant_id"
end
create_table "plutus_amounts", force: :cascade do |t|
t.string "type"
t.integer "account_id"
t.integer "entry_id"
t.decimal "amount", precision: 20, scale: 10
t.integer "relationship_id"
end
add_index "plutus_amounts", ["relationship_id", "type"], name: "index_plutus_amounts_on_relationship_id_and_type"
add_index "plutus_amounts", ["type"], name: "index_plutus_amounts_on_type"
create_table "plutus_entries", force: :cascade do |t|
t.string "description"
t.integer "commercial_document_id"
t.string "commercial_document_type"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "plutus_entries", ["commercial_document_id", "commercial_document_type"], name: "index_entries_on_commercial_doc"
create_table "organizations", force: :cascade do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "relationships", force: :cascade do |t|
t.string "entity_name"
t.string "first_name"
t.string "last_name"
t.datetime "created_at"
t.datetime "updated_at"
t.string "tax_id"
t.integer "customer_terms"
t.string "w9"
t.string "routing_number"
t.string "ssn"
t.integer "organization_id"
t.boolean "is_org"
t.boolean "is_vendor", default: false
t.boolean "is_customer", default: false
t.boolean "is_bank", default: false
t.boolean "is_employee", default: false
t.boolean "is_govt", default: false
t.integer "vendor_terms"
t.boolean "is_investor", default: false
t.string "salutation"
t.string "screen_name"
end