search for: item_pag

Displaying 10 results from an estimated 10 matches for "item_pag".

Did you mean: item_pages
2006 Apr 16
11
Best way to sort categories w/ pager
Ahoy, I made this pager, " def list @item_pages = Paginator.new self, Item.count, 10, @params[''page''] @items = Item.find :all, :conditions => "category_id = #{params[:condition]}", :limit => @item_pages.items_per_page, :offset => @item_pages.current....
2006 Feb 13
1
Paginate @member.items?
Is there a quick and easy way to paginate something like @member.items (Member with has_many :items)? Right now I do in the controller: @item_pages, @member_items = paginate :item, :conditions=>["member_id=?", @member.id], :per_page=>25, :order=>''datetime desc'' It''d be more DRY if this was possible: @item_pages, @member_items = paginate @member.items, :per_page=>25, :order=>'...
2006 Apr 16
7
table sorting
Ahoy, I checked the API and did some forum searches but didn''t find anything good on table sorting. Is there a "railish" way to do this? My current method really is lacking (i''m on like rails day 2) <th><%= link_to ''Name'', :action => ''list'', :order => ''name'' %></th>
2006 Jun 21
7
acts_as_taggable and paginate?
Hi there, I''ve been trying to paginate over a list of members that all share a tag in common using the acts_as_taggable plugin. The regular way of paginating over a collection doesn''t seem to work with acts_as_taggable. Here''s what my method looks like that takes in a tag name, finds all the members that share the tag and then displays all the members. Nothing too fancy
2006 Feb 23
6
Search Forms with Pagination
Hi there everyone, I''ve recently moved to RoR and am still struggling with the basics of what used to be second nature in php, so on with my question: I have a database with products, and I need to create a search form that paginates the results. What I have so far in my controller is: def list # If the values are nil, then set them, otherwise wrap them in % # Also,
2005 Dec 19
6
custom find methods and pagination
i''ve got several methods in my models i use to find based on certain criteria...i''ve done this so the controller code is less cluttered, plus the DRY factor. example: class Foo < ActiveRecord::Base def find_by_something(something) find :all, :joins => ..., :conditions => ... end def find_by_something_else(something_else) find :all, :joins => ...,
2007 Jun 20
1
Count_by_content ??
...||= 1).to_i items_per_page = 20 offset = (page - 1) * items_per_page # step 2: instead of performing a find, just get a count item_count = Item.count_with_some_custom_method() # step 3: create a Paginator, the second argument has to be the number of ALL items on all pages @item_pages = Paginator.new(self, item_count, items_per_page, page) # step 4: only find the requested subset of @items @items = Item.find_with_some_custom_method(items_per_page, offset) end -- Posted via http://www.ruby-forum.com/.
2006 May 25
13
.NET developer trying to understand some Rails basics
Hi All, I''ve been a ASP.NET developer for the last few years and consider it to be a pretty productive environment to work with. However, the object-relational mapping (ActiveRecord) and simplicity of the Rails framework and Ruby in general really appeals to me. .NET currently doesn''t have something like Rails'' ORM - atleast not out-of-the-box. Here''s my
2006 Apr 13
2
Dynamic finder conditions
...;' AND " } condition[0..-5].to_s end --some_controller.rb def list paginator_options = {:per_page => 10} conditions = dynamic_conditions_from_hash(params, Item) unless conditions.empty? paginator_options.merge!({:conditions => conditions}) end @item_pages, @items = paginate :items, paginator_options end Thanks, and I hope this helps! Daniel
2005 Dec 30
11
Losing my mind with Ajax link_to_remote
...;%= link_to_remote navigation.name, :url => {:controller => "listing", :action => "browse", :id => navigation.id, :update => "navigation"} %> <br/> <% end %> And my browse method is: def browse if @params[:id] @item_pages, @items = paginate(:items, :per_page => 10, :conditions => ["category_id = ?", params[:id].to_i]) else @item_pages, @items = paginate(:items, :per_page => 10) end end Now, the basic premise is that the page should first look somet...