similar to: Expiring items

Displaying 20 results from an estimated 10000 matches similar to: "Expiring items"

2006 Apr 19
4
Another DRY question
I have some code working that lists only items from a particular user. The code in my list action finds the user and then conditionally lists only his/her items: def list user = User.find(session[:user]) user_id = user.id @product_pages, @products = paginate :products, :per_page => 10, :conditions =>[''user_id = ?'', user.id]
2006 Apr 19
2
Filtering items within scaffold
I''m messing with the agiles store example. I added a field in my product table (user_id) that is also a foreign key relationship via fk_products_user In my scaffold I''d like to list the products as usual, but only those products from the logged in user. I assume that would be done in the controller.. How would I extend the basic controller: def list @product_pages,
2006 May 14
3
Beginner question on paginate with params and conditions
I am trying to do a simple search by product name. The first page returns fine, but when I try to go to any other pages of the search results, I lose the original search parameters from my search form and get NilClass errors. Here is the code in my controller: namesearch = "%" + params[:name].strip + "%" @product_pages, @products = paginate :product,
2006 Aug 14
2
need a warning for destroy all
I wrote a small controller to find all the expired items and destroy them: @listtodestroy=Product.find(:all, :conditions => [''user_id = ? AND date_expires <= ?'', @user.id, Time.now]) for product in @listtodestroy product.destroy end It works fine but there''s no warning that everything is about to be removed like when I call product.destroy
2006 Jan 04
7
wrong number of arguments error
I keep getting this error every time I try to pass a value to a method. Here is a sample nonworking method. I''ve been pulling my hair out over this all night! Why won''t it work!? My url path is :3000/store/browse/shoes and I''m getting this in the log Parameters: {"action"=>"browse", "id"=>"shoes",
2006 Apr 27
5
def list - paginate question
How do I adapt this code to only list articles made by the user logged into the session? def list @article_pages, @article = paginate :articles, :per_page => 10 end -- Posted via http://www.ruby-forum.com/.
2008 Nov 27
7
will_paginate issue
Hi, I am trying paginate (will_paginate) users posts. It is counting and showing the page links correctly, but still showing all the posts on one page. @entries = @user.entries.paginate :per_page => 5, :page => params[:page], :order => ''created_at DESC'' If I change it to @entries = Entry.paginate :per_page => 5 ........ It is fine, but I would like to show only
2006 Jan 26
1
Simple question about :list method in scaffolds
The automatically generated scaffolds made code like this: def list @address_pages, @addresses = paginate :addresses, :per_page => 10 end which was fine, but I only want to return the logged-in user''s addresses. So I changed it to: def list @address_pages, @addresses = paginate :addresses, :per_page => 10, :conditions => [''user_id = ?'',
2005 Dec 19
1
<% unless params[:context] == :gallery -%> question
I have a template that is called by two different methods. I only want part of it too show up when it is called from one of the methods. It always shows up for me. Can someone help to point out my error? Below is the method that should keep part of the tempate from printing, and the relevent part of the template. method: def gallery @product_pages,@products = paginate(:products,
2006 Jul 05
3
list of users
Hi all, I''m creating admin module. in that module i need to get the list of users and also the projects created by the each user. No doubt i''m getting the list of users. but i''m not getting the list of projects done by each user.. This is my code:: <% for user in @users %> <%=link_to
2006 Jan 06
2
Paginate from a difficult sql query
Hello, I have 2 tables table colors : +----------------------+ | id | user_id | name | +----------------------+ | 1 | 1 | test1 | | 2 | 2 | test2 | | 3 | 3 | test3 | +----------------------+ table users : +----------------------+ | id | enabled | name | +----------------------+ | 1 | 1 | bob | | 2 | 1
2006 Aug 15
2
Working with user data
I am a Rails newbie and I am trying to build a test site in which users will have their own sets of data. I understand how to manipulate shared data very well. Most of the Rails examples out there seem to deal with such shared data. I am struggling with the "best practice" method for a user to work with their own data however (and not be able to view/edit other users''
2005 Dec 16
13
How to pass a collection to paginate?
There must be a better way to write this code: @project_pages, @projects= paginate :project, :per_page => 10, :conditions => ["account_id = ?", account] ?! If only I could pass the sub-collection account = ... @projects = account.project to paginate, instead of letting it extract it with a find :all + sql conditions Alain. -- Posted via
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
2006 Apr 07
2
Paginate single items
Hi, In my blog i display a post. I want to display a link tot he previous post if there is 1 and a link tot he next post if there is one. So i have in my controller def post @post = Post.find(params[:id]) @post_pages, @posts = paginate :posts, :per_page => 1 render(:layout => false) end And the following code in post.rhtml <% if @post_pages.current.next %> <%=
2006 Feb 07
11
breaking down a list view
I''m trying to figure out how to change the order of a list view and it''s obvious to me that I don''t understand what I get from a simple scaffold to know enough to alter it. If someone would be so kind to tell me what this means ... def list @placment_pages, @placements = paginate :placements, :per_page => 10 end @placement_pages, # I am guessing that this
2006 May 23
5
Wierd pagination problem - Unknown options: order?
I am trying to use pagination with the order option. I am following examples I''ve seen all over the web, but I am getting an error. My code seems simple: def list @upload_pages, @uploads = paginate :uploads, :per_page => 20, :order => ''id'' end Yet I keep getting this error: ___________________________________________
2006 Jan 25
6
cant convert integer to string
I''ve experimented around and have ran out of ideas, here''s the message: TypeError in True_false_questions#list can''t convert String into Integer RAILS_ROOT: script/../config/.. Application Trace <http://zbyte32:3000/true_false_questions/list/0#> | Framework Trace <http://zbyte32:3000/true_false_questions/list/0#> | Full
2007 Jan 15
2
Help with with displaying a selected list.
Hello. I call a find_all_by_subject("action") which returns 2 videos and displays them properly. But when I add @video_pages, @videos = paginate :videos, :per_page => 10 so I can paginate the videos, it displays ALL the videos as if I selected list videos. Can someone please tell me what I am doing wrong? Thank you. selectaction.rhtml <table> <tr> <% x = 0 %>
2008 Feb 29
7
Moving pagination to the Model
I''m using will_paginate in a Post class method; [code]def self.list(page) paginate :per_page => 10, :page => page, :include => :user end[/code] I can happily use the method on my posts controller index action; [code] class PostsController < ApplicationController def index @posts = Post.list(params[:page]) respond_to do |format|