1
0
Fork 0

Paginate action Settions::ContactsController#index

This commit is contained in:
Alex Kotov 2019-09-03 20:44:06 +05:00
parent 48fa4eb81e
commit a5f637feff
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
3 changed files with 7 additions and 1 deletions

View file

@ -13,7 +13,7 @@ class Settings::ContactsController < ApplicationController
def index
authorize [:settings, Contact]
@contacts = @contact_list.contacts
@contacts = @contact_list.contacts.page(params[:page])
end
# POST /settings/contacts

View file

@ -9,6 +9,7 @@
<% unless @contacts.nil? %>
<%= render partial: 'table', locals: { contacts: @contacts } %>
<%= paginate @contacts %>
<% end %>
</div>
</div>

View file

@ -6,6 +6,11 @@ RSpec.describe 'GET /settings/contacts' do
before do
sign_in current_account.user if current_account&.user
if current_account
create_list :some_contact, rand(1..3),
contact_list: current_account.contact_list
end
get '/settings/contacts'
end