diff options
author | Peter Kozak <spag@golwen.net> | 2013-06-13 11:21:32 +0200 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-06-13 11:21:32 +0200 |
commit | 23b112aee1979033c58735b1a028cd92210cec09 (patch) | |
tree | b13248aa95387603620e5403ccc6c5da00c09100 /app/controllers/phones_controller.rb | |
parent | 525aaf6dcb5bafe5a949a078dee6abb24d87e2a5 (diff) |
display tenant and user phones combined
Diffstat (limited to 'app/controllers/phones_controller.rb')
-rw-r--r-- | app/controllers/phones_controller.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index cfa6d7b..77e7b5e 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -9,10 +9,17 @@ class PhonesController < ApplicationController helper_method :sort_column, :sort_descending def index - @phones = @parent.phones.order(sort_column + ' ' + (sort_descending ? 'DESC' : 'ASC')).paginate( - :page => params[:page], - :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE') - ) + if @parent.class == Tenant + @phones = @parent.tenant_user_phones.order(sort_column + ' ' + (sort_descending ? 'DESC' : 'ASC')).paginate( + :page => params[:page], + :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE') + ) + else + @phones = @parent.phones.order(sort_column + ' ' + (sort_descending ? 'DESC' : 'ASC')).paginate( + :page => params[:page], + :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE') + ) + end end def show |