Issues with Plugins
silvermind opened this issue · 8 comments
the plugin config has been moved to the Tentant Class which is scoped by the Appartement gem.. Not sure if the code is aware of the appartement refactoring yet..
What's the best way to enable plugins atm? Are the per installation or per Apratement-Tenant..
see also: huerlisi/bookyt_salary#6
@huerlisi I assume that the Appartement Tenant is not active when the engine loader is executed at: https://github.com/huerlisi/bookyt/blob/master/lib/bookyt/engine.rb
@huerlisi the plugins with multiple tenants do not work for me, do you have an example app with source, which is working with pluging based on the new appartement version?
Will take a look into that, will get back to you...
The modules can be enables/disabled per Apartment-Tenant. There is currently no UI for that.
To enable a module do something like this:
$ bundle exec rails c
Loading development environment (Rails 3.2.22)
[1] pry(main)> Apartment::Tenant.switch 'test'
=> "\"test\""
[2] pry(main)> t = Tenant.first
Tenant Load (0.6ms) SELECT "tenants".* FROM "tenants" LIMIT 1
=> #<Tenant id: 1, person_id: 2, created_at: "2010-12-31 08:44:34", updated_at: "2015-09-04 15:57:14", incorporated_on: nil, fiscal_year_ends_on: "2000-01-12", vat_number: "", use_vesr: true, print_payment_for: false, uid_number: "", ahv_number: "">
[3] pry(main)> t.settings(:modules).active
=> []
[4] pry(main)> t.settings(:modules).active = ['bookt_salay']
=> ["bookt_salay"]
[5] pry(main)> t.save
(0.1ms) BEGIN
HasVcards::Vcard Load (0.4ms) SELECT "has_vcards_vcards".* FROM "has_vcards_vcards" WHERE "has_vcards_vcards"."reference_id" = 2 AND "has_vcards_vcards"."reference_type" = 'Person' LIMIT 1
(0.3ms) UPDATE "settings" SET "value" = '---
active:
- bookt_salay
', "updated_at" = '2015-09-18 10:35:54.552379' WHERE "settings"."id" = 4
(3.7ms) COMMIT
=> true
This would enable the bookyt_salary
module for the test
Tenant.
@huerlisi thx for your help, there steps i've executed for all tenants.
The bookyt_salary.css was still missing in the asset pipleine.. after disabling the engine_stylesheet_link_tag in silvermind@7ff65a5
I got this issue:
uninitialized constant BookySalary
lib/bookyt/engine.rb:18:in setup_navigation_engine' lib/bookyt/engine.rb:12:in
block in setup_navigation'
lib/bookyt/engine.rb:11:in map' lib/bookyt/engine.rb:11:in
setup_navigation'
app/views/overview/index.html.haml:3:in `_app_views_overview_index_html_haml__1027224352712258279_70316085798320'
no luck yet, would you be available for a short consulting session via skype? :)
arr, had a typo in the module name, nevermind it now all works! 👍
per tenant:
t = Tenant.first
t.settings(:modules).active = ['bookyt_salary']
t.save!