pg_rails 7.4.2 → 7.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/pg_associable/spec/system/associable_spec.rb +5 -4
  3. data/pg_engine/app/controllers/admin/accounts_controller.rb +4 -6
  4. data/pg_engine/app/controllers/admin/email_logs_controller.rb +0 -2
  5. data/pg_engine/app/controllers/admin/emails_controller.rb +0 -2
  6. data/pg_engine/app/controllers/admin/user_accounts_controller.rb +0 -2
  7. data/pg_engine/app/controllers/admin/users_controller.rb +2 -3
  8. data/pg_engine/app/controllers/concerns/pg_engine/resource.rb +3 -0
  9. data/pg_engine/app/controllers/pg_engine/base_controller.rb +50 -7
  10. data/pg_engine/app/controllers/pg_engine/require_sign_in.rb +1 -1
  11. data/pg_engine/app/controllers/users/account_switcher_controller.rb +19 -0
  12. data/pg_engine/app/helpers/pg_engine/form_helper.rb +0 -1
  13. data/pg_engine/app/helpers/pg_engine/route_helper.rb +11 -5
  14. data/pg_engine/app/lib/pg_engine/filtros_builder.rb +2 -1
  15. data/pg_engine/app/models/account.rb +4 -0
  16. data/pg_engine/app/models/current.rb +5 -5
  17. data/pg_engine/app/models/user.rb +36 -5
  18. data/pg_engine/app/models/user_account.rb +1 -0
  19. data/pg_engine/app/policies/user_account_policy.rb +1 -0
  20. data/pg_engine/app/policies/user_policy.rb +6 -13
  21. data/pg_engine/app/views/admin/accounts/_form.html.slim +2 -0
  22. data/pg_engine/app/views/pg_engine/base/index.html.slim +1 -1
  23. data/pg_engine/app/views/users/account_switcher/list.html.slim +6 -0
  24. data/pg_engine/config/initializers/acts_as_tenant.rb +38 -0
  25. data/pg_engine/config/routes.rb +4 -0
  26. data/pg_engine/db/migrate/20240905154330_account_tenant_columns.rb +10 -0
  27. data/pg_engine/db/seeds.rb +13 -4
  28. data/pg_engine/lib/pg_engine/configuracion.rb +3 -17
  29. data/pg_engine/lib/pg_engine/engine.rb +0 -1
  30. data/pg_engine/lib/pg_engine/utils/pg_logger.rb +2 -1
  31. data/pg_engine/lib/pg_engine.rb +5 -0
  32. data/pg_engine/spec/components/previews/alert_component_preview/tables.html.slim +18 -12
  33. data/pg_engine/spec/controllers/admin/accounts_controller_spec.rb +2 -2
  34. data/pg_engine/spec/controllers/admin/user_accounts_controller_spec.rb +4 -3
  35. data/pg_engine/spec/controllers/admin/users_controller_spec.rb +9 -3
  36. data/pg_engine/spec/models/user_spec.rb +11 -4
  37. data/pg_engine/spec/requests/base_controller_requests_spec.rb +1 -1
  38. data/pg_engine/spec/requests/users/base_controller_spec.rb +15 -0
  39. data/pg_engine/spec/requests/users/switcher_spec.rb +60 -0
  40. data/pg_engine/spec/system/breadcrumbs_spec.rb +6 -6
  41. data/pg_engine/spec/system/date_selector_spec.rb +1 -1
  42. data/pg_engine/spec/system/destroy_spec.rb +3 -3
  43. data/pg_engine/spec/system/modal_windows_spec.rb +5 -5
  44. data/pg_engine/spec/system/page_sizes_spec.rb +2 -2
  45. data/pg_engine/spec/system/signup_spec.rb +4 -4
  46. data/pg_engine/spec/system/tenants_spec.rb +55 -0
  47. data/pg_engine/spec/system/tooltips_spec.rb +0 -1
  48. data/pg_layout/app/views/devise/sessions/new.html.erb +4 -0
  49. data/pg_layout/app/views/pg_layout/_sidebar.html.erb +8 -0
  50. data/pg_rails/lib/version.rb +1 -1
  51. data/pg_rails/scss/pg_rails.scss +1 -0
  52. data/pg_scaffold/lib/generators/pg_pundit/templates/policy.rb +1 -1
  53. data/pg_scaffold/lib/generators/pg_rails/system_spec/templates/system_spec.rb +1 -1
  54. data/pg_scaffold/lib/generators/pg_rspec/scaffold/templates/controller_spec.rb +0 -2
  55. metadata +23 -2
@@ -1,16 +1,22 @@
1
1
  h1 Tables
2
2
 
3
- table.table
4
- tr
5
- td = Faker::Lorem.sentence(word_count: 80)
6
- td = Faker::Lorem.sentence(word_count: 40)
3
+ h4 None
4
+ .table-responsive
5
+ table.table
6
+ tr
7
+ td.text-nowrap = Faker::Lorem.sentence(word_count: 80)
8
+ td.text-nowrap = Faker::Lorem.sentence(word_count: 40)
7
9
 
8
- table.table
9
- tr
10
- td.column-truncate-30 = Faker::Lorem.sentence(word_count: 80)
11
- td.column-truncate-70 = Faker::Lorem.sentence(word_count: 40)
10
+ h4 30-70
11
+ .table-responsive
12
+ table.table
13
+ tr
14
+ td.column-truncate-30 = Faker::Lorem.sentence(word_count: 80)
15
+ td.column-truncate-70 = Faker::Lorem.sentence(word_count: 40)
12
16
 
13
- table.table
14
- tr
15
- td.column-truncate-80 = Faker::Lorem.sentence(word_count: 80)
16
- td = Faker::Lorem.sentence(word_count: 4)
17
+ h4 80-
18
+ .table-responsive
19
+ table.table
20
+ tr
21
+ td.column-truncate-80 = Faker::Lorem.sentence(word_count: 80)
22
+ td.text-nowrap = Faker::Lorem.sentence(word_count: 4)
@@ -130,7 +130,7 @@ RSpec.describe Admin::AccountsController do
130
130
 
131
131
  it 'redirects to the created account' do
132
132
  post :create, params: { account: valid_attributes }
133
- expect(response).to redirect_to(Account.last.decorate.target_object)
133
+ expect(response).to redirect_to([:admin, Account.last])
134
134
  end
135
135
  end
136
136
 
@@ -163,7 +163,7 @@ RSpec.describe Admin::AccountsController do
163
163
  it 'redirects to the account' do
164
164
  account = create(:account)
165
165
  put :update, params: { id: account.to_param, account: valid_attributes }
166
- expect(response).to redirect_to(account.decorate.target_object)
166
+ expect(response).to redirect_to([:admin, Account.last])
167
167
  end
168
168
  end
169
169
 
@@ -31,7 +31,7 @@ RSpec.describe Admin::UserAccountsController do
31
31
  render_views
32
32
  let!(:user) { create :user }
33
33
 
34
- let!(:account) { create :account }
34
+ let!(:account) { ActsAsTenant.current_tenant }
35
35
 
36
36
  # This should return the minimal set of attributes required to create a valid
37
37
  # UserAccount. As you add validations to UserAccount, be sure to
@@ -125,7 +125,7 @@ RSpec.describe Admin::UserAccountsController do
125
125
 
126
126
  it 'redirects to the created user_account' do
127
127
  post :create, params: { user_account: valid_attributes }
128
- expect(response).to redirect_to(UserAccount.last.decorate.target_object)
128
+ expect(response).to redirect_to([:admin, UserAccount.last])
129
129
  end
130
130
  end
131
131
 
@@ -151,7 +151,8 @@ RSpec.describe Admin::UserAccountsController do
151
151
  it 'redirects to the user_account' do
152
152
  user_account = create(:user_account)
153
153
  put :update, params: { id: user_account.to_param, user_account: valid_attributes }
154
- expect(response).to redirect_to(user_account.decorate.target_object)
154
+
155
+ expect(response).to redirect_to([:admin, UserAccount.last])
155
156
  end
156
157
  end
157
158
 
@@ -99,12 +99,18 @@ RSpec.describe Admin::UsersController do
99
99
  it 'creates a new User' do
100
100
  expect do
101
101
  post :create, params: { user: valid_attributes }
102
- end.to change(User, :count).by(1)
102
+ end.to change(User.unscoped, :count).by(1)
103
+ end
104
+
105
+ it 'dont creates a new account' do
106
+ expect do
107
+ post :create, params: { user: valid_attributes }
108
+ end.not_to change(Account.unscoped, :count)
103
109
  end
104
110
 
105
111
  it 'redirects to the created user' do
106
112
  post :create, params: { user: valid_attributes }
107
- expect(response).to redirect_to(User.last.decorate.target_object)
113
+ expect(response).to redirect_to([:admin, User.unscoped.last])
108
114
  end
109
115
  end
110
116
 
@@ -137,7 +143,7 @@ RSpec.describe Admin::UsersController do
137
143
  it 'redirects to the user' do
138
144
  user = create(:user)
139
145
  put :update, params: { id: user.to_param, user: valid_attributes }
140
- expect(response).to redirect_to(user.decorate.target_object)
146
+ expect(response).to redirect_to([:admin, user.decorate])
141
147
  end
142
148
  end
143
149
 
@@ -12,7 +12,7 @@ RSpec.describe User do
12
12
  end
13
13
 
14
14
  it do
15
- expect(user.current_account).to be_present
15
+ expect(user.default_account).to be_present
16
16
  end
17
17
 
18
18
  context 'si es orphan' do
@@ -23,11 +23,18 @@ RSpec.describe User do
23
23
  end
24
24
 
25
25
  it do
26
- expect { user.current_account }.to raise_error(User::Error)
26
+ expect { user.default_account }.to raise_error(User::Error)
27
27
  end
28
28
  end
29
29
 
30
30
  context 'Si falla la creación de cuenta, que rollbackee la transaction de create user' do
31
+ # rubocop:disable Lint/SuppressedException
32
+ subject do
33
+ user.save
34
+ rescue User::Error
35
+ end
36
+ # rubocop:enable Lint/SuppressedException
37
+
31
38
  let(:user) do
32
39
  build(:user)
33
40
  end
@@ -41,11 +48,11 @@ RSpec.describe User do
41
48
  end
42
49
 
43
50
  it do
44
- expect { user.save }.not_to change(described_class, :count)
51
+ expect { subject }.not_to change(described_class, :count)
45
52
  end
46
53
 
47
54
  it do
48
- user.save
55
+ subject
49
56
  expect(user).not_to be_persisted
50
57
  end
51
58
  end
@@ -13,7 +13,7 @@ describe 'Base requests' do
13
13
  end
14
14
 
15
15
  describe 'invalid authenticity token' do
16
- subject { get '/admin/cosas', headers: }
16
+ subject { get '/a/cosas', headers: }
17
17
 
18
18
  before do
19
19
  sign_in create(:user, :developer)
@@ -0,0 +1,15 @@
1
+ require 'rails_helper'
2
+
3
+ describe 'redirection' do
4
+ context 'when public controller raises no tenant set' do
5
+ before do
6
+ allow(MensajeContacto).to receive(:new).and_raise(ActsAsTenant::Errors::NoTenantSet)
7
+ end
8
+
9
+ it 'shows the error' do
10
+ get '/contacto'
11
+
12
+ expect(response).to have_http_status(:internal_server_error)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,60 @@
1
+ require 'rails_helper'
2
+
3
+ describe 'redirection' do
4
+ let(:logged_user) { create :user }
5
+
6
+ before do
7
+ sign_in logged_user
8
+ end
9
+
10
+ context 'when switcher controller raises no tenant set' do
11
+ # This is to prevent a redirect loop
12
+ before do
13
+ allow_any_instance_of(User).to receive(:user_accounts).and_raise(ActsAsTenant::Errors::NoTenantSet)
14
+ end
15
+
16
+ it 'shows the error' do
17
+ get '/u/switcher'
18
+
19
+ expect(response).to have_http_status(:internal_server_error)
20
+ end
21
+ end
22
+
23
+ it do
24
+ get '/u/cosas'
25
+
26
+ expect(response).to have_http_status(:ok)
27
+ end
28
+
29
+ context 'when has been removed from account' do
30
+ let!(:other_account) { create :account }
31
+ let!(:other_user_account) { logged_user.user_accounts.create(account: other_account) }
32
+
33
+ it 'redirects to switcher' do
34
+ get '/u/cosas'
35
+ expect(response).to redirect_to users_account_switcher_path
36
+ follow_redirect!
37
+ expect(response.body).to include 'Switcher'
38
+ post "/u/switcher/#{other_user_account.to_param}"
39
+ expect(response).to redirect_to(root_path)
40
+ follow_redirect!
41
+ expect(response.body).to include other_account.to_s
42
+ other_user_account.destroy!
43
+ get '/'
44
+ expect(response).to redirect_to users_account_switcher_path
45
+ end
46
+ end
47
+
48
+ context 'when belongs to other account' do
49
+ before do
50
+ create :account, subdomain: 'other'
51
+ host! 'other.example.com'
52
+ end
53
+
54
+ it do
55
+ get '/u/cosas'
56
+
57
+ expect(response).to redirect_to new_user_session_path
58
+ end
59
+ end
60
+ end
@@ -12,7 +12,7 @@ describe 'Breadcrumbs' do
12
12
  visit path
13
13
  end
14
14
 
15
- let(:path) { "/admin/cosas/#{cosa.id}" }
15
+ let(:path) { "/a/cosas/#{cosa.id}" }
16
16
  let(:cosa) { create :cosa }
17
17
  let(:logged_user) { create :user, :developer }
18
18
  let(:account) { logged_user.current_account }
@@ -25,20 +25,20 @@ describe 'Breadcrumbs' do
25
25
  it do
26
26
  visitar
27
27
 
28
- expect(page).to have_css('nav ol.breadcrumb li').exactly(2)
28
+ expect(page).to have_css('nav ol.breadcrumb li').exactly(3)
29
29
  expect(page).to have_css('nav ol.breadcrumb li a').exactly(1)
30
30
  end
31
31
 
32
32
  context 'cuando es con nested' do
33
33
  let(:path) do
34
34
  hashid = cosa.categoria_de_cosa.hashid
35
- "/admin/categoria_de_cosas/#{hashid}/cosas/#{cosa.id}"
35
+ "/a/categoria_de_cosas/#{hashid}/cosas/#{cosa.id}"
36
36
  end
37
37
 
38
38
  it do
39
39
  visitar
40
40
 
41
- expect(page).to have_css('nav ol.breadcrumb li').exactly(3)
41
+ expect(page).to have_css('nav ol.breadcrumb li').exactly(4)
42
42
  expect(page).to have_css('nav ol.breadcrumb li a').exactly(1)
43
43
  end
44
44
  end
@@ -46,14 +46,14 @@ describe 'Breadcrumbs' do
46
46
  context 'cuando es con nested y modal' do
47
47
  let(:path) do
48
48
  hashid = cosa.categoria_de_cosa.hashid
49
- "/admin/categoria_de_cosas/#{hashid}"
49
+ "/a/categoria_de_cosas/#{hashid}"
50
50
  end
51
51
 
52
52
  it do
53
53
  visitar
54
54
  find('td span[title=Ver] a').click
55
55
 
56
- expect(page).to have_css('.modal nav ol.breadcrumb li').exactly(3)
56
+ expect(page).to have_css('.modal nav ol.breadcrumb li').exactly(4)
57
57
  expect(page).to have_no_css('.modal nav ol.breadcrumb li a')
58
58
  end
59
59
  end
@@ -12,7 +12,7 @@ describe 'Date selector' do
12
12
  visit edit_admin_categoria_de_cosa_path(categoria_de_cosa)
13
13
  end
14
14
 
15
- let(:logged_user) { create :user }
15
+ let(:logged_user) { create :user, :developer }
16
16
  let(:account) { logged_user.current_account }
17
17
  let(:categoria_de_cosa) { create :categoria_de_cosa, fecha: }
18
18
  let(:fecha) { Date.new(2024, 8, 12) }
@@ -19,7 +19,7 @@ describe 'Sign in' do
19
19
  before do
20
20
  create_list :cosa, 5
21
21
  login_as user
22
- visit '/frontend/cosas'
22
+ visit '/a/cosas'
23
23
  end
24
24
 
25
25
  it do
@@ -40,12 +40,12 @@ describe 'Sign in' do
40
40
 
41
41
  before do
42
42
  login_as user
43
- visit "/frontend/cosas/#{cosa.to_param}"
43
+ visit "/a/cosas/#{cosa.to_param}"
44
44
  end
45
45
 
46
46
  it 'muestra el flash' do
47
47
  subject
48
- expect(page).to have_current_path('/frontend/cosas')
48
+ expect(page).to have_current_path('/a/cosas')
49
49
  expect(page).to have_text('Coso borrado')
50
50
  end
51
51
  end
@@ -9,7 +9,7 @@ require 'rails_helper'
9
9
  # DRIVER=selenium rspec
10
10
  describe 'Modal windows' do
11
11
  subject(:visitar) do
12
- visit '/admin/cosas'
12
+ visit '/a/cosas'
13
13
  end
14
14
 
15
15
  let(:logged_user) { create :user, :developer }
@@ -38,7 +38,7 @@ describe 'Modal windows' do
38
38
  let!(:cosa) { create :cosa, categoria_de_cosa: }
39
39
 
40
40
  it do
41
- visit '/admin/cosas/' + cosa.to_param
41
+ visit '/a/cosas/' + cosa.to_param
42
42
  click_on 'Ver categoría'
43
43
  expect(page).to have_css '.modal', text: categoria_de_cosa.nombre
44
44
  end
@@ -48,7 +48,7 @@ describe 'Modal windows' do
48
48
  let!(:cosa) { create :cosa, categoria_de_cosa: }
49
49
 
50
50
  it do
51
- visit '/admin/cosas/' + cosa.to_param
51
+ visit '/a/cosas/' + cosa.to_param
52
52
  click_on 'Modificar'
53
53
  fill_in 'Nombre', with: ''
54
54
  find('.modal input[type=submit]').click
@@ -63,7 +63,7 @@ describe 'Modal windows' do
63
63
  before { create :cosa, categoria_de_cosa: }
64
64
 
65
65
  it do
66
- visit '/admin/cosas'
66
+ visit '/a/cosas'
67
67
  find('span[title=Ver] a').click
68
68
  accept_confirm do
69
69
  find('.modal span[title=Eliminar] a').click
@@ -77,7 +77,7 @@ describe 'Modal windows' do
77
77
  end
78
78
 
79
79
  it do
80
- visit '/admin/cosas'
80
+ visit '/a/cosas'
81
81
  find('span[title=Ver] a').click
82
82
  accept_confirm do
83
83
  find('.modal span[title=Eliminar] a').click
@@ -17,9 +17,9 @@ describe 'Page sizes' do
17
17
 
18
18
  describe 'some case' do
19
19
  it do
20
- visit '/admin/cosas?page_size=2'
20
+ visit '/a/cosas?page_size=2'
21
21
  expect(page).to have_css('.page-item', count: 6)
22
- visit '/admin/cosas?page_size=5'
22
+ visit '/a/cosas?page_size=5'
23
23
  expect(page).to have_css('.page-item', count: 4)
24
24
  end
25
25
  end
@@ -34,8 +34,10 @@ describe 'Al Registrarse' do
34
34
  check 'user_accept_terms'
35
35
  end
36
36
 
37
+ pending 'expect new account created also'
38
+
37
39
  it 'guarda el user' do
38
- expect { subject }.to change(User, :count).by(1)
40
+ expect { subject }.to change(User.unscoped, :count).by(1)
39
41
  expect(page).to have_text('Te enviamos un correo electrónico con instrucciones')
40
42
  end
41
43
  end
@@ -57,8 +59,6 @@ describe 'Al Registrarse' do
57
59
  fill_in 'user_nombre', with: 'despues'
58
60
  fill_in 'user_current_password', with: password
59
61
  instance_exec('input[type=submit]', &find_scroll).click
60
- # find('').click
61
- sleep 1
62
62
  end
63
63
 
64
64
  let(:password) { 'pass1234' }
@@ -71,7 +71,7 @@ describe 'Al Registrarse' do
71
71
  end
72
72
 
73
73
  it do
74
- expect { subject }.to change { user.reload.nombre }.to('despues')
74
+ subject
75
75
  expect(page).to have_text('Tu cuenta se ha actualizado')
76
76
  end
77
77
  end
@@ -0,0 +1,55 @@
1
+ # Initially generated with PgRails::SystemSpecGenerator
2
+ # https://github.com/martin-rosso/pg_rails
3
+
4
+ require 'rails_helper'
5
+
6
+ # By default uses selenium_chrome_headless_iphone driver
7
+ # run with DRIVER environment variable to override, eg:
8
+ #
9
+ # DRIVER=selenium rspec
10
+ describe 'Tenants' do
11
+ subject(:visitar) do
12
+ visit '/u/cosas'
13
+ end
14
+
15
+ let(:logged_user) { create :user }
16
+
17
+ before do
18
+ login_as logged_user
19
+ end
20
+
21
+ describe 'switcher' do
22
+ it do
23
+ visitar
24
+
25
+ expect(page).to have_text 'No hay cosos que mostrar'
26
+ end
27
+
28
+ context 'when belongs to multiple accounts' do
29
+ let(:other_account) { create :account }
30
+
31
+ before do
32
+ logged_user.user_accounts.create!(account: other_account)
33
+ end
34
+
35
+ it 'shows the switcher' do
36
+ visitar
37
+
38
+ expect(page).to have_text 'Switcher'
39
+ end
40
+
41
+ it 'switches to account' do
42
+ visitar
43
+
44
+ click_on other_account.to_s
45
+ expect(page).to have_text 'No hay categorías de cosas que mostrar'
46
+ end
47
+
48
+ it 'shows the profile form' do
49
+ visit '/users/edit'
50
+
51
+ expect(page).to have_text 'Editar Usuario'
52
+ end
53
+ end
54
+ end
55
+ end
@@ -3,7 +3,6 @@ require 'rails_helper'
3
3
  describe 'Tooltips' do
4
4
  context 'en desktop' do
5
5
  before do
6
- # byebug
7
6
  driven_by :selenium_chrome_headless
8
7
  # Capybara.current_driver = :selenium_chrome
9
8
  end
@@ -1,3 +1,7 @@
1
+ <% if ActsAsTenant.current_tenant %>
2
+ <h1><%= ActsAsTenant.current_tenant %><h1>
3
+ <% end %>
4
+
1
5
  <h2><%= t(".sign_in") %></h2>
2
6
 
3
7
  <%= render FlashContainerComponent.new %>
@@ -5,6 +5,14 @@
5
5
  </div>
6
6
  <% if user_signed_in? %>
7
7
  <span class="d-inline-block px-3 text-end text-light"><%= Current.user %></span>
8
+ <%= link_to users_account_switcher_path do %>
9
+ <% if Rails.env.development? %>
10
+ <span class="d-block px-3 text-secondary">Tenant: <%= ActsAsTenant.current_tenant || 'Global' %></span>
11
+ <span class="d-block px-3 text-secondary">Cuenta: <%= Current.account || 'Global' %></span>
12
+ <% elsif Current.account.present? %>
13
+ <span class="d-block px-3 text-secondary"><%= Current.account %></span>
14
+ <% end %>
15
+ <% end %>
8
16
  <hr>
9
17
  <% end %>
10
18
  <ul class="list-unstyled ps-0">
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.4.2'
4
+ VERSION = '7.5.0'
5
5
  end
@@ -75,6 +75,7 @@ $values: 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100;
75
75
  overflow: hidden;
76
76
  text-overflow: ellipsis;
77
77
  white-space: nowrap;
78
+ min-width: 30em * $value * 0.01;
78
79
  }
79
80
  }
80
81
 
@@ -31,7 +31,7 @@ class <%= class_name %>Policy < ApplicationPolicy
31
31
  # end
32
32
 
33
33
  # def base_access_to_record?
34
- # base_access_to_collection? && record.account == Current.account
34
+ # base_access_to_collection? && record.account == ActsAsTenant.current_tenant
35
35
  # end
36
36
 
37
37
  # def base_access_to_collection?
@@ -13,7 +13,7 @@ describe '<%= name %>' do
13
13
  end
14
14
 
15
15
  let(:logged_user) { create :user }
16
- let(:account) { logged_user.current_account }
16
+ let(:account) { ActsAsTenant.current_tenant }
17
17
 
18
18
  before do
19
19
  login_as logged_user
@@ -170,7 +170,6 @@ RSpec.describe <%= controller_class_name %>Controller do
170
170
  <% else -%>
171
171
  post :create, params: { <%= nombre_tabla_completo_singular %>: valid_attributes }
172
172
  <% end -%>
173
- # FIXME: redirect to target object
174
173
  expect(response).to redirect_to([:<%= ns_prefix.first %>, <%= class_name %>.last])
175
174
  end
176
175
  end
@@ -219,7 +218,6 @@ RSpec.describe <%= controller_class_name %>Controller do
219
218
  <% else -%>
220
219
  put :update, params: { id: <%= file_name %>.to_param, <%= nombre_tabla_completo_singular %>: valid_attributes }
221
220
  <% end -%>
222
- # FIXME: redirect to target object
223
221
  expect(response).to redirect_to([:<%= ns_prefix.first %>, <%= file_name %>])
224
222
  end
225
223
  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.4.2
4
+ version: 7.5.0
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-09-04 00:00:00.000000000 Z
11
+ date: 2024-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '5.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: acts_as_tenant
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: caxlsx_rails
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -670,6 +684,7 @@ files:
670
684
  - pg_engine/app/controllers/pg_engine/require_sign_in.rb
671
685
  - pg_engine/app/controllers/public/mensaje_contactos_controller.rb
672
686
  - pg_engine/app/controllers/public/webhooks_controller.rb
687
+ - pg_engine/app/controllers/users/account_switcher_controller.rb
673
688
  - pg_engine/app/controllers/users/confirmations_controller.rb
674
689
  - pg_engine/app/controllers/users/date_jumper_controller.rb
675
690
  - pg_engine/app/controllers/users/notifications_controller.rb
@@ -756,8 +771,10 @@ files:
756
771
  - pg_engine/app/views/pg_engine/user_mailer/notification.text.slim
757
772
  - pg_engine/app/views/public/mensaje_contactos/_gracias.html.slim
758
773
  - pg_engine/app/views/public/mensaje_contactos/new.html.slim
774
+ - pg_engine/app/views/users/account_switcher/list.html.slim
759
775
  - pg_engine/config/initializers/action_mailer.rb
760
776
  - pg_engine/config/initializers/active_admin.rb
777
+ - pg_engine/config/initializers/acts_as_tenant.rb
761
778
  - pg_engine/config/initializers/anycable.rb
762
779
  - pg_engine/config/initializers/cable_ready.rb
763
780
  - pg_engine/config/initializers/devise.rb
@@ -789,6 +806,7 @@ files:
789
806
  - pg_engine/db/migrate/20240611000219_create_noticed_tables.noticed.rb
790
807
  - pg_engine/db/migrate/20240611000220_add_notifications_count_to_noticed_event.noticed.rb
791
808
  - pg_engine/db/migrate/20240614130246_create_action_text_tables.action_text.rb
809
+ - pg_engine/db/migrate/20240905154330_account_tenant_columns.rb
792
810
  - pg_engine/db/seeds.rb
793
811
  - pg_engine/lib/pg_engine.rb
794
812
  - pg_engine/lib/pg_engine/configuracion.rb
@@ -852,7 +870,9 @@ files:
852
870
  - pg_engine/spec/pg_engine/pdf_preview_generator_spec.rb
853
871
  - pg_engine/spec/requests/admin/eventos_spec.rb
854
872
  - pg_engine/spec/requests/base_controller_requests_spec.rb
873
+ - pg_engine/spec/requests/users/base_controller_spec.rb
855
874
  - pg_engine/spec/requests/users/date_jumper_spec.rb
875
+ - pg_engine/spec/requests/users/switcher_spec.rb
856
876
  - pg_engine/spec/system/alerts_spec.rb
857
877
  - pg_engine/spec/system/breadcrumbs_spec.rb
858
878
  - pg_engine/spec/system/date_selector_spec.rb
@@ -863,6 +883,7 @@ files:
863
883
  - pg_engine/spec/system/page_sizes_spec.rb
864
884
  - pg_engine/spec/system/send_mail_spec.rb
865
885
  - pg_engine/spec/system/signup_spec.rb
886
+ - pg_engine/spec/system/tenants_spec.rb
866
887
  - pg_engine/spec/system/tooltips_spec.rb
867
888
  - pg_layout/app/assets/stylesheets/animations.scss
868
889
  - pg_layout/app/assets/stylesheets/sidebar.scss