mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-23 07:09:39 +02:00
* Consolidate entry controller logic * Transaction builder * Update trades controller to use new params * Load account charts in turbo frames, fix PG overflow * Consolidate tests * Tests passing * Remove unused code * Add client side trade form validations
26 lines
595 B
Ruby
26 lines
595 B
Ruby
class Account::EntriesController < ApplicationController
|
|
layout :with_sidebar
|
|
|
|
before_action :set_account
|
|
|
|
def index
|
|
@q = search_params
|
|
@pagy, @entries = pagy(entries_scope.search(@q).reverse_chronological, limit: params[:per_page] || "10")
|
|
end
|
|
|
|
private
|
|
def set_account
|
|
@account = Current.family.accounts.find(params[:account_id])
|
|
end
|
|
|
|
def entries_scope
|
|
scope = Current.family.entries
|
|
scope = scope.where(account: @account) if @account
|
|
scope
|
|
end
|
|
|
|
def search_params
|
|
params.fetch(:q, {})
|
|
.permit(:search)
|
|
end
|
|
end
|