Francisco Quinones

Joined

7,370 Experience
40 Lessons Completed
2 Questions Solved

Activity

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.

Posted in Multitenancy with the Apartment gem Discussion

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

Posted in filter child record by the parent.

thank you ill look at it :)

Posted in filter child record by the parent.

How can I do this achive this with cancan at the moment. I like to move to pundit but have to get this setup as fast as I can.

This my ability file

      class Ability
      include CanCan::Ability


      def initialize(user)
        #-----------------------------------------------------------------
        if user.role == "super_admin"
          can :manage, [ServiceCompany,User] #,:dashboard]
          cannot :manage,[ClientCompany,Company,Project,Employee,Inspection,InspectionSection,
            InspectionComponent,Section,Reply,ServiceUser,ClientUser,TaskArea,TaskSection,TaskItem,Accident,
            Incident,Training,Workorder,Turnover,:help,:project_report,:report,Complaint,Payroll]
          #-----------------------------------------------------------------
        elsif user.role == "admin"
          can :manage, [ClientCompany,Company,Employee,Inspection,InspectionSection,InspectionComponent,Section,Reply,ServiceUser,ClientUser,TaskArea,TaskSection,TaskItem,:help]
          can :manage,[Project]
          can [:read,:index,:destroy,:edit,:update,:create], [Accident,Incident,Training,Workorder,Turnover,Payroll]
          # can [:read,:index], Payroll
          can [:read,:edit,:update,:remove_photo], ServiceCompany
          can [:read,:edit,:update,:index,:destroy],Complaint
          can [:index,:trainings,:inspections_total,:workorders,:incidents,:accidents,:turnovers],:project_report
          can [:index,:trainings,:inspections],:report
          can :read, ServiceCompany
          #---------Cannot----------
          cannot :index, ServiceCompany
          #-----------------------------------------------------------------
        elsif user.role == "auditor"
          can [:read, :index], [Project,Complaint,:project_report,:report,:help]
           #---------Cannot----------
          cannot :index, ServiceCompany
          #-----------------------------------------------------------------
        elsif user.role == "cliente"
          can [:create, :read, :index], [Complaint,Reply]
          can [:show], [ClientCompany]
          cannot :index, ClientCompany
          cannot :index, InspectionSection
          can [:index,:inspections],:report
          can [:index,:read,:detail], Inspection
          can [:report_table], InspectionSection
          can [:index,:trainings,:inspections_total,:workorders,:incidents,:accidents,:turnovers],:project_report
          can [:read, :index], [Project,:help]
          #---------Cannot----------
          cannot :index, ClientCompany
          #-----------------------------------------------------------------
        elsif user.role == "gerente"
          can [:create,:read,:update,:destroy,:edit,:signature,:detail], [Accident,Incident,Training,Workorder,Turnover,Inspection,InspectionComponent,Reply,Payroll,Employee]
          can [:create,:read,:update,:destroy,:edit,:report_table],InspectionSection
          can [:index,:show],[Project,TaskArea,TaskSection,ClientCompany,:help]
          can [:index,:trainings,:inspections_total,:workorders,:incidents,:accidents,:turnovers],:project_report
          can [:index,:trainings,:inspections],:report
          can [:read,:index,:edit,:update], [TaskItem,Complaint]  
          can :read, ServiceCompany
          #---------Cannot----------
          cannot :index, ServiceCompany
          #-----------------------------------------------------------------
        else user.role == "administraciĆ³n"
            can [:index,:show,:read,:signature,:detail],[ClientCompany,Company,Project,Employee,Inspection,
            InspectionComponent,Section,Reply,ServiceUser,ClientUser,TaskArea,TaskSection,TaskItem,Accident,Incident,Training,
            Workorder,Turnover,:help,Payroll]
            can [:index,:show,:read,:report_table], InspectionSection
            can [:index,:trainings,:inspections],:report
            can [:index,:trainings,:inspections_total,:workorders,:incidents,:accidents,:turnovers],:project_report
            can [:create, :read, :index], Reply
            can [:edit,:update,:read, :index],Complaint
            can :read, ServiceCompany
            #---------Cannot----------
            cannot :index, ServiceCompany
        end
      end
    end


Posted in filter child record by the parent.

can I do the same with cancan as I got all working and setup. Thanx

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.