Skip to content

Commit

Permalink
Make it easier to get related record data
Browse files Browse the repository at this point in the history
  • Loading branch information
sachac committed Jun 10, 2015
1 parent ba7c1d7 commit 6fd4f25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/controllers/records_controller.rb
Expand Up @@ -15,13 +15,16 @@ def index
end
@order = params[:order]
@records = Record.get_records(current_account, :order => @order, :include_private => managing?, :start => @start, :end => @end, :filter_string => @filter_string)
if params[:category_type]
@records = @records.where('record_categories.category_type=?', [params[:category_type]])
end
if request.format.csv?
if params[:split] and params[:split] == 'split'
@records = Record.split(@records)
end
@data = @records
else
@records = @records.paginate :page => params[:page]
@records = @records.paginate :page => params[:page], :per_page => params[:per_page]
base = @records
@pre_split = @records
if params[:split] and params[:split] == 'split'
Expand Down
1 change: 1 addition & 0 deletions app/models/record.rb
Expand Up @@ -477,6 +477,7 @@ def self.get_records(account, options = {})
unless options[:include_private]
records = records.public_records
end
records = records.joins(:record_category).select('records.*, record_categories.full_name, record_categories.color, record_categories.name, record_categories.parent_id, record_categories.category_type')
records
end

Expand Down

0 comments on commit 6fd4f25

Please sign in to comment.