pg_rails 7.6.21.pre.2 → 7.6.21.pre.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6698336321ce3bb886aa1de70219bab209e2f8b2f1b3f867282a29f1f1ebf5a5
4
- data.tar.gz: fae76eef1209ba3e463740c8818ebd406a0b387eab151d964519fe0f5a389cec
3
+ metadata.gz: 5c7e8b1261e1be1d5db2d19ca5b4102f0bca77ae9f379da78249d2087e44736b
4
+ data.tar.gz: 455549bec4416393199d4b713cb653f008e4ff42a4d70f4923a1aff7b9dc1e78
5
5
  SHA512:
6
- metadata.gz: 55b7bc4417466c09110d4e48c4ee7355fdfc7bcf8e153592f9e0418fe518803953b73a6c3584274992aa3624cf6073b0ddab327e9971d7bb17923fbd176322ed
7
- data.tar.gz: c51ce96d9af18a24111adc2130ae196290df313198561b4d6b23f59447b6d5d7762c5907bb1bcac59c7aabfbfc439b75324e06901d48de98181462b95c7e4582
6
+ metadata.gz: a94f33c4e747a6bae8d710c9a25ffea315f8d49cfadee1d111396381203d90c7716e160e45b6e5348b7389d4b0ef409c45c8d67b9df0fd8215ac111e84919b1a
7
+ data.tar.gz: f399f20faaccb9a7f9d5aa49c349faa67e1b1e7e56f850ba023f3a1b1471c1d35607dac07ee4fd1d8b39f733979add05bb0e98238b6352378cfe9fdb179a040c
@@ -2,6 +2,7 @@
2
2
  module PgAssociable
3
3
  module FormBuilderMethods
4
4
  def self.included(mod)
5
+ mod.include PgEngine::DefaultUrlOptions
5
6
  mod.include Rails.application.routes.url_helpers
6
7
  mod.include PgEngine::RouteHelper
7
8
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  class PgAssociableInput < SimpleForm::Inputs::StringInput
4
4
  include ActionView::Helpers::FormTagHelper
5
+ include PgEngine::DefaultUrlOptions
5
6
  include Rails.application.routes.url_helpers
6
7
  include PgEngine::RouteHelper
7
8
 
@@ -1,22 +1,22 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe 'Associable' do
4
- let(:user) { create :user, :developer }
4
+ let(:user) { create :user, :owner }
5
5
 
6
- let(:path) { '/a/cosas/new' }
6
+ let(:path) { '/u/t/cosas/new' }
7
7
 
8
8
  before do
9
9
  login_as user
10
10
  visit path
11
11
  end
12
12
 
13
- it do
13
+ fit do
14
14
  fill_in 'cosa_nombre', with: 'La cosa'
15
15
  select 'Los', from: 'cosa_tipo'
16
16
  find('.cosa_categoria_de_cosa input[type=text]').click
17
17
  expect(page).to have_text :all, 'Nueva categoría de cosa'
18
18
  find('.cosa_categoria_de_cosa .list-group-item').click
19
- select Account.first.to_s
19
+ # select Account.first.to_s
20
20
  fill_in 'categoria_de_cosa_nombre', with: 'la categoría'
21
21
  select 'Completar', from: 'categoria_de_cosa_tipo'
22
22
  click_on 'Agregar Categoría de cosa'
@@ -26,7 +26,7 @@ describe 'Associable' do
26
26
 
27
27
  context 'cuando crea desde el nested' do
28
28
  let!(:categ) { create :categoria_de_cosa }
29
- let(:path) { "/a/categoria_de_cosas/#{categ.hashid}/cosas/new" }
29
+ let(:path) { "/u/t/categoria_de_cosas/#{categ.hashid}/cosas/new" }
30
30
 
31
31
  it do
32
32
  input = find_by_id('cosa_categoria_de_cosa')
@@ -37,7 +37,7 @@ describe 'Associable' do
37
37
  context 'cuando edita desde el nested' do
38
38
  let!(:categ) { create :categoria_de_cosa }
39
39
  let!(:cosa) { create :cosa, categoria_de_cosa: categ }
40
- let(:path) { "/a/categoria_de_cosas/#{categ.hashid}/cosas/#{cosa.id}/edit" }
40
+ let(:path) { "/u/t/categoria_de_cosas/#{categ.hashid}/cosas/#{cosa.id}/edit" }
41
41
 
42
42
  it do
43
43
  ele = find_by_id('cosa_categoria_de_cosa_id', visible: :all)
@@ -39,7 +39,7 @@ class UserAccount < ApplicationRecord
39
39
  belongs_to :creado_por, optional: true, class_name: 'User'
40
40
  belongs_to :actualizado_por, optional: true, class_name: 'User'
41
41
 
42
- validates :user_id, uniqueness: { scope: :account_id }
42
+ validates_uniqueness_to_tenant :user_id
43
43
 
44
44
  after_destroy :cleanup_invitation
45
45
  def cleanup_invitation
@@ -3,4 +3,11 @@ class AddMembershipStatusToUserAccounts < ActiveRecord::Migration[7.2]
3
3
  add_column :user_accounts, :membership_status, :integer, null: false, default: 1
4
4
  add_column :user_accounts, :invitation_status, :integer, null: false, default: 1
5
5
  end
6
+
7
+ def migrate(direction)
8
+ if direction == :up
9
+ UserAccount.update_all(profiles: [0])
10
+ end
11
+ super
12
+ end
6
13
  end
@@ -70,8 +70,11 @@ FactoryBot.define do
70
70
  end
71
71
 
72
72
  trait :owner do
73
- user_accounts do
74
- [build(:user_account, account: ActsAsTenant.current_tenant, profiles: [:account__owner])]
73
+ after(:create) do |model|
74
+ model.user_accounts.create!(profiles: [:account__owner])
75
+ # ActsAsTenant.with_tenant(create(:account)) do
76
+ # model.user_accounts.create!(profiles: [:account__owner])
77
+ # end
75
78
  end
76
79
  end
77
80
  end
@@ -13,10 +13,6 @@ RSpec.describe User do
13
13
  expect(UserAccount.first.profiles).to include(:account__owner)
14
14
  end
15
15
 
16
- it do
17
- expect(user.default_account).to be_present
18
- end
19
-
20
16
  describe 'search ransacker' do
21
17
  it 'searchs' do
22
18
  results = described_class.ransack(search_cont: user.nombre).result.to_a
@@ -44,7 +44,7 @@
44
44
  i.bi.bi-person-circle.me-2 style="font-size: 1.7em"
45
45
  = Current.user
46
46
  ul.dropdown-menu
47
- li = link_to 'Perfil', edit_user_registration_path(tid: nil), class: 'dropdown-item'
47
+ li = link_to 'Mi cuenta', edit_user_registration_path(tid: nil), class: 'dropdown-item'
48
48
  li = link_to Account.model_name.human(count: 2), users_accounts_path(tid: nil), class: 'dropdown-item'
49
49
  - if Current.user.developer?
50
50
  li = link_to 'Admin', admin_users_path, class: 'dropdown-item'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.6.21.pre.2'
4
+ VERSION = '7.6.21-3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.6.21.pre.2
4
+ version: 7.6.21.pre.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Rosso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-02 00:00:00.000000000 Z
11
+ date: 2024-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails