diff options
author | Nicholas Seckar <nseckar@gmail.com> | 2005-08-31 00:13:10 +0000 |
---|---|---|
committer | Nicholas Seckar <nseckar@gmail.com> | 2005-08-31 00:13:10 +0000 |
commit | 87b68002827015d887dd566c477b957d8e5cb842 (patch) | |
tree | e37cda974d714a10c841bc463b411e275d0de307 /actionpack/lib/action_controller/pagination.rb | |
parent | 34e795ff0e8cf91c8bd1e2938d161acafe74e2c0 (diff) | |
download | rails-87b68002827015d887dd566c477b957d8e5cb842.tar.gz rails-87b68002827015d887dd566c477b957d8e5cb842.tar.bz2 rails-87b68002827015d887dd566c477b957d8e5cb842.zip |
Add option to specify the singular name used by pagination. Closes #1960
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2078 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/pagination.rb')
-rw-r--r-- | actionpack/lib/action_controller/pagination.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/pagination.rb b/actionpack/lib/action_controller/pagination.rb index a3e8f36d70..709b56bfba 100644 --- a/actionpack/lib/action_controller/pagination.rb +++ b/actionpack/lib/action_controller/pagination.rb @@ -63,6 +63,7 @@ module ActionController # The default options for pagination DEFAULT_OPTIONS = { :class_name => nil, + :singular_name => nil, :per_page => 10, :conditions => nil, :order_by => nil, @@ -91,7 +92,7 @@ module ActionController "Unknown options: #{unknown_option_keys.join(', ')}" unless unknown_option_keys.empty? - options[:singular_name] = Inflector.singularize(collection_id.to_s) + options[:singular_name] ||= Inflector.singularize(collection_id.to_s) options[:class_name] ||= Inflector.camelize(options[:singular_name]) end @@ -101,8 +102,10 @@ module ActionController # ClassMethods#paginate. # # +options+ are: - # <tt>:class_name</tt>:: the class name to use, if it can't be inferred by + # <tt>:singular_name</tt>:: the singular name to use, if it can't be inferred by # singularizing the collection name + # <tt>:class_name</tt>:: the class name to use, if it can't be inferred by + # camelizing the singular name # <tt>:per_page</tt>:: the maximum number of items to include in a # single page. Defaults to 10 # <tt>:conditions</tt>:: optional conditions passed to Model.find(:all, *params) and |