Francisco Quinones
Joined
Activity
@chris another quick question. You told me to use resque better for background jobs, for some reason resque is not looking at the sub tenant, I get a error Record ID not found I think its looking on the main table and not that subdomain table.
Couldn't find TaskTran with 'id'=26
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-4.2.4/lib/active_record/relation/finder_methods.rb:324:in `raise_record_not_found_exception!'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-4.2.4/lib/active_record/relation/finder_methods.rb:444:in `find_one'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-4.2.4/lib/active_record/relation/finder_methods.rb:423:in `find_with_ids'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-4.2.4/lib/active_record/relation/finder_methods.rb:71:in `find'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/delayed_paperclip-2.9.1/lib/delayed_paperclip.rb:34:in `process_job'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/delayed_paperclip-2.9.1/lib/delayed_paperclip/jobs/active_job.rb:12:in `perform'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/execution.rb:32:in `block in perform_now'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:117:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:117:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:505:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:505:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:343:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/i18n-0.7.0/lib/i18n.rb:257:in `with_locale'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/translation.rb:7:in `block (2 levels) in <module:Translation>'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:441:in `instance_exec'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:441:in `block in make_lambda'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:342:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:342:in `block in simple'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:497:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:497:in `block in around'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:505:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:505:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:343:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/logging.rb:23:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/logging.rb:23:in `block (4 levels) in <module:Logging>'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/notifications.rb:164:in `block in instrument'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/notifications.rb:164:in `instrument'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/logging.rb:22:in `block (3 levels) in <module:Logging>'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/logging.rb:43:in `block in tag_logger'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/tagged_logging.rb:68:in `block in tagged'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/tagged_logging.rb:26:in `tagged'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/tagged_logging.rb:68:in `tagged'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/logging.rb:43:in `tag_logger'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/logging.rb:19:in `block (2 levels) in <module:Logging>'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:441:in `instance_exec'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:441:in `block in make_lambda'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:342:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:342:in `block in simple'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:497:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:497:in `block in around'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:505:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:505:in `call'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:778:in `_run_perform_callbacks'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-4.2.4/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/execution.rb:31:in `perform_now'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/execution.rb:21:in `execute'
/Users/IFrank/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activejob-4.2.4/lib/active_job/queue_adapters/resque_adapter.rb:46:in `perform'
quick question cron jobs run normal on Multitenancy app
This the code that I have if it dont run normal I was think of doing the block code so it runs in each tanent
# Company.all.each do |c|
# Apartment::Tenant.switch!('c.subdomain')
every 1.month, :at => '1st 6:00am' do
runner "User.email_task_list"
runner "Task.generate_new_trans" # class Task.method
end
# end
@chris can we use this on are production apps???
Posted in Activity Feed From Scratch Discussion
Love it keep it up Chris
OMG! found it I was using
user_name: 'USERNAME',
password: 'PASSWORD',
and not this
user_name: ENV['USERNAME'],
password: ENV['PASSWORD'],
Thank you thank you
I got this in the terminal
Net::SMTPAuthenticationError (535-5.7.8 Username and Password not accepted. Learn more at):
Ok I get back to you on that thank you very much! Chris keep up the good work love everything that your doing. will recommend you!
Chris Love it I need it this a year ago but love to learn your approach on this
Hi! any more info that you need let me know as im looking to fix this problem. Thank Chris as always.
Dev
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
# config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :letter_opener
# config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: '587',
domain: 'gmail.com',
user_name: 'USERNAME',
password: 'PASSWORD',
authentication: 'plain',
enable_starttls_auto: true }
Production
config.action_mailer.default_url_options = { host: 'appname.herokuapp.com'}
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'gmail.com',
user_name: 'USERNAME',
password: 'PASSWORD',
authentication: 'plain',
enable_starttls_auto: true }
Hi I did the Multitenancy app works great only problem that im having is on production the app wont send email. On local machine it send it with no problem.
Any help and what info that you need let me know thank you.
Posted in Multitenancy with the Apartment gem
I think im goin to try sidekiq. :)
Posted in Multitenancy with the Apartment gem
Chris you're a lifesaver as always I look at how can I call the user.company.subdomain on the authentication methond
I need to edit this so it use the subdomain
def self.find_for_database_authentication(warden_conditions)
conditions = warden_conditions.dup
if login = conditions.delete(:login)
where(conditions.to_h).where(["lower(username) = :value OR lower(email) = :value", { :value => login}]).first
else
where(conditions.to_h).first
end
end
. On the background Job I got it setup with delayed_job is theres a way of using it or I have to move to sidekiq.
Posted in Multitenancy with the Apartment gem
Hi! @chris oliver I got the multitenant app running local and manage to create the subdomain and tranfer data from the public schema to the subdomain one. Now I got 2 problems the first one is I need to verify the user belongs to that subdomain but I dont know how to do this as the subdomain is in the company table. Here they use the user table for the scope. https://github.com/plataformatec/devise/wiki/How-to:-Scope-login-to-subdomain
and the second problem that I got is the background jobs are not running is there any setting that I have to do. Thank you for any help
Posted in Multitenancy with the Apartment gem
Hi Chris Im trying to apply the Multitenancy to a exiting app. at the moment the tenant get create. how can I use the exiting that to be one of the tenant. When I enter with a exiting user to the tenant I get error because is looking for data that doesnot exit in that DBs.
Im using devise and have the subdomain in the company and not the user model.
Thank. uf you need more info just let me know.
Thank Chris for the quick response. and Yes I saw that one and looks pretty nasty for a solution. On my app im using a User Model and 2 User type ServiceUser and ClientUser that belongs to the User Model. I think this a better solution for getting Devise and Multitenancy working fast and without any hacks.
Hi im trying to have 3 type of devise users but one to have a single login. I need to find a way to make the routes to go to a site/login for all 3 of then.
Im not using the 1 User model with 3 type of User like roles beacuse each of the type of user has he's on role types. example: Admin has 3 rols Admin, Super Admin and Moderator.
Can I do this with company. So when I create a company the company gets the subdomain. and do something like User.company.subdomain to look for the tenant ??? as my app is goin to have User model and Admin model. Admin will create the Companies and User for the companies
Posted in filter child record by the parent.
wow super this a big step for me. thank you for your time. next Multitenancy.
Posted in filter child record by the parent.
Thank I found a way to do it but its going to make the file to big can I create some tipe of partical like??
So I can clean the class ability
example:
class Ability
include CanCan::Ability
include super_admin_ability
def initialize(user)
if user.role == "super_admin"
super_admin_ability
end
end
end
Class SuperAdminAbility
def super_admin_ability
can :manage, [ServiceCompany,User]
end
end