Paginate action Settions::ContactsController#index
This commit is contained in:
parent
48fa4eb81e
commit
a5f637feff
3 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
<% unless @contacts.nil? %>
|
||||
<%= render partial: 'table', locals: { contacts: @contacts } %>
|
||||
<%= paginate @contacts %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Reference in a new issue