search for: product_pages

Displaying 8 results from an estimated 8 matches for "product_pages".

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] end So far so good! Now I''d like to create an object an automatically add the user''s id to the user_id field in the product...
2006 Apr 22
7
Expiring items
In my database I have a products table that has a bunch of attributes (title, description, etc) including one for date_expires. Is there a best practices method to get the database to erase the expired items? Is that done outside RoR via Cron or something? Else is it better to just have my app filter out anything that is expired but still keep those records in my dbase? -- Posted via
2006 May 14
3
Beginner question on paginate with params and conditions
...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, :conditions => ["product_name like :name", {:name => namesearch}], :per_page => 10 This seems like it should be a very common task and I assumed RoR would handle it automatically by adding the original search parameters to...
2006 Jan 04
7
wrong number of arguments error
...#39;'t it work!? My url path is :3000/store/browse/shoes and I''m getting this in the log Parameters: {"action"=>"browse", "id"=>"shoes", "controller"=>"store"} # function to browse the store def browse (category) @product_pages,@products = paginate(:products, :per_page => 12, :conditions => "status= ''current'', category = #{category}") render :templat...
2006 Apr 19
2
Filtering items within scaffold
...ble (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, @products = paginate :products, :per_page => 10 end to Also account for the logged in user? Thanks.. -- Posted via http://www.ruby-forum.com/.
2005 Dec 19
1
<% unless params[:context] == :gallery -%> question
...ethods. 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, :per_page => 12, :conditions => "sold != ''current''") render( :template => "store/index", :params => { :context => :gallery}) end template: <% unless params[:context] == :...
2007 Aug 17
1
Scaffold (Agile Web Development With Rails)
...def index list render :action => ''list'' end # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) verify :method => :post, :only => [ :destroy, :create, :update ], :redirect_to => { :action => :list } def list @product_pages, @products = paginate :products, :per_page => 10 end [app/controllers/admin_controller.rb] [output] NoMethodError in AdminController#index undefined method `paginate'' for #<AdminController:0xb77e0b78> RAILS_ROOT: /home/davi/documentos/rails/depot Application Trace | Framewo...
2006 Jan 26
42
ruby script/generate scaffold Product Admin hangs
Hi I am running Mac OX tiger with the installed ruby 1.8.2, and mysql5 (I checked that it was running in preference). I tried to run the various fixes recommended in agileweb. I am stuck on page 57, script/generate scaffold... > Could you paste in your database.yml file, from the > "config" folder inside your Rails app? If you have any > passwords entered there, you should