pg_rails 7.6.21.pre.1 → 7.6.21.pre.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/pg_associable/app/helpers/pg_associable/form_builder_methods.rb +1 -0
- data/pg_associable/app/inputs/pg_associable_input.rb +1 -0
- data/pg_associable/spec/system/associable_spec.rb +6 -6
- data/pg_engine/app/models/current.rb +8 -0
- data/pg_engine/app/models/user.rb +5 -5
- data/pg_engine/app/models/user_account.rb +1 -1
- data/pg_engine/db/migrate/20241027225618_add_membership_status_to_user_accounts.rb +7 -0
- data/pg_engine/db/seeds.rb +1 -1
- data/pg_engine/spec/factories/users.rb +5 -2
- data/pg_engine/spec/models/user_spec.rb +0 -4
- data/pg_layout/app/views/layouts/pg_layout/base.html.slim +1 -0
- data/pg_layout/app/views/pg_layout/_signed_in_links.html.slim +1 -1
- data/pg_rails/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c7e8b1261e1be1d5db2d19ca5b4102f0bca77ae9f379da78249d2087e44736b
|
4
|
+
data.tar.gz: 455549bec4416393199d4b713cb653f008e4ff42a4d70f4923a1aff7b9dc1e78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a94f33c4e747a6bae8d710c9a25ffea315f8d49cfadee1d111396381203d90c7716e160e45b6e5348b7389d4b0ef409c45c8d67b9df0fd8215ac111e84919b1a
|
7
|
+
data.tar.gz: f399f20faaccb9a7f9d5aa49c349faa67e1b1e7e56f850ba023f3a1b1471c1d35607dac07ee4fd1d8b39f733979add05bb0e98238b6352378cfe9fdb179a040c
|
@@ -1,22 +1,22 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
3
|
describe 'Associable' do
|
4
|
-
let(:user) { create :user, :
|
4
|
+
let(:user) { create :user, :owner }
|
5
5
|
|
6
|
-
let(:path) { '/
|
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
|
-
|
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) { "/
|
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) { "/
|
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)
|
@@ -3,6 +3,14 @@ class Current < ActiveSupport::CurrentAttributes
|
|
3
3
|
# attribute :request_id, :user_agent, :ip_address
|
4
4
|
|
5
5
|
# resets { Time.zone = nil }
|
6
|
+
def active_user_account
|
7
|
+
# Para los jobs
|
8
|
+
if attributes[:active_user_account].nil? && user.present? && account.present?
|
9
|
+
attributes[:active_user_account] = user.active_user_account_for(account)
|
10
|
+
end
|
11
|
+
|
12
|
+
super
|
13
|
+
end
|
6
14
|
|
7
15
|
def tid
|
8
16
|
active_user_account.to_param
|
@@ -132,12 +132,12 @@ class User < ApplicationRecord
|
|
132
132
|
|
133
133
|
class Error < PgEngine::Error; end
|
134
134
|
|
135
|
-
def default_account
|
136
|
-
|
135
|
+
# def default_account
|
136
|
+
# raise Error, 'El usuario debe tener cuenta' if accounts.empty?
|
137
137
|
|
138
|
-
|
139
|
-
|
140
|
-
end
|
138
|
+
# user_accounts.first.account
|
139
|
+
# # throw :warden, scope: :user, message: :user_not_belongs_to_account
|
140
|
+
# end
|
141
141
|
|
142
142
|
deprecate :current_account, deprecator: PgEngine.deprecator
|
143
143
|
|
@@ -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
|
-
|
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
|
data/pg_engine/db/seeds.rb
CHANGED
@@ -13,4 +13,4 @@ rené = FactoryBot.create(:user, email: 'rene@bien.com', nombre: 'René', apelli
|
|
13
13
|
confirmed_at: Time.now)
|
14
14
|
|
15
15
|
racionalismo.user_accounts.create!(user: baruch, profiles: [:account__owner])
|
16
|
-
racionalismo.user_accounts.create!(user: rené, profiles: [
|
16
|
+
racionalismo.user_accounts.create!(user: rené, profiles: [])
|
@@ -70,8 +70,11 @@ FactoryBot.define do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
trait :owner do
|
73
|
-
|
74
|
-
|
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 '
|
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'
|
data/pg_rails/lib/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2024-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|