Commit f6480330 authored by Mateus Ravedutti's avatar Mateus Ravedutti

Add service places and service types manyo to many relationship

parent d88733e1
Pipeline #6885 passed with stage
in 7 minutes and 17 seconds
......@@ -4,6 +4,7 @@ class ServicePlace < ApplicationRecord
has_many :professionals_service_places
has_many :professionals, :through => :professionals_service_places
has_and_belongs_to_many :accounts
has_and_belongs_to_many :service_types
# Validations #
validates_presence_of :address_number
class ServiceType < ApplicationRecord
belongs_to :sector
has_and_belongs_to_many :service_places
def self.all_active
ServiceType.where(active: true)
class CreateJoinTableServiceTypesServicePlaces < ActiveRecord::Migration[5.0]
def change
create_join_table :service_types, :service_places do |t|
# t.index [:service_type_id, :service_place_id]
# t.index [:service_place_id, :service_type_id]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment