Displaying 20 results from an estimated 26 matches for "date_available".
2006 Jan 19
0
file_column error: tmp file created but not actual
...4) [POST]
Parameters: {"commit"=>"Create",
"wallpaper"=>{"downloads"=>"0", "date_created"=>"Wed
Jan 18 23:20:12 PST 2006", "price"=>"0.0",
"title"=>"test logger4", "date_available(1i)"=>"2006",
"image_temp"=>"", "date_available(2i)"=>"1",
"description"=>"test4", "date_available(3i)"=>"18",
"date_available(4i)"=>"23", "user_id"=>&qu...
2006 Jan 27
4
testing for nil numeric value in find
In the agile/rails tutorial book the following construct is added
to products.rb.
def self.salable_items
find( :all,
:conditions => "date_available <= now()",
:order => "date_available desc")
end
Now, I wish to extend :conditions => to exclude products that have
a nil value for the price. I have tried different syntax using
"price.nil?", "not", and "!", but have...
2006 Apr 20
7
checking date
Radrails created a field for date
<%= product.date_available.strftime("%y-%m-%d") %>
What does this mean?
Should the definition be date or datetime? I tried both and no results
Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060420/ed0cbb14/attachment....
2006 Feb 28
3
Agile Web Development Example Application Question
...ontrollers/store_controller.rb>
class StoreController < ApplicationController
def index
@products = Product.salable_items
end
end
and in the app/models/product.rb I have the new piece of code
____snip____
def self.salable_items
find(:all,
:conditions => "date_available <= now()",
:order => "date_available desc")
end
_____end snip____
When I try to access the store page, it returns:
Couldn''t find Product with ID=all AND date_available <= now()
/app/models/product.rb:21:in `salable_items''
app/controllers...
2006 Mar 04
2
unittest, not loading yml data
Here is my products.yml
version_control_book:
id: 1
title: Pragmatic Version Control
description: How to use version control
image_url: /images/sk_svn_small.jpg
price: 29.95
date_available: 2005-01-26 00:00:00
automation_book:
id: 2
title: Pragmatic Project Automation
description: How to automate your project
image_url: /images/sk_auto_small.jpg
price: 29.95
date_available: 2004-07-01 00:00:00
and I was trying to use @products...
2006 Aug 07
4
Unit testing diffculty
ok, let me show you my "products" fixtures file:
ram:
id: 1
title: RAM
description: ECC RAM Registered, 512MB
image_url: images/test.jpg
price: 29.95
date_available: 2005-01-25 00:00:00
busted_arsehole:
id: 2
title: Busted Arsehole
description: I have an arsehole, it is-e busted
image_url: images/test.jpg
price: 999.95
date_available: 2005-01-25 00:00:00
hey:
id: 3
title: hey
description: testinggggg
image_url:...
2006 Aug 06
6
Having Problem w/ Agile Web Development book
...dError in StoreController#index
undefined method `salable_items'' for Product:Class
and here is my store_controller.rb ...
class StoreController < ApplicationController
def index
@products = Product.salable_items
end
def self.salable_items
find(:all, :conditions => "date_available <= now()", :order =>
"date_available desc")
end
end
What am I doing wrong?
--
Posted via http://www.ruby-forum.com/.
2006 Dec 04
3
uninitialized constant Product
...as page 73 where I did ruby
script/generate controller Store index, then edited
store_controller.rb to
class StoreController < ApplicationController
def index
@products = Product.salable_items
end
end
and product.rb to:
def self.salable_items
find(:all,
:conditions => "date_available <= now()",
:order => "date_available desc")
end
but it keeps showing this error in http://localhost:3000/store/ :
NameError in StoreController#index
uninitialized constant Product
RAILS_ROOT: script/../config/..
Application Trace | Framework Trace | Full Trace...
2006 Apr 01
6
how to use datepicker
This is the webpage:
http://projects.exactlyoneturtle.com/date_picker/
I have downloaded and installed it. But how do I use in view page?
This is the usual view with ordinary datetime_select:
<p><label for="product_date_available">Date available</label><br/>
<%= datetime_select ''product'', ''date_available'' %></p>
So I have table named ''product'' with one of the column named
''date_available''. How do I use date_picker rathe...
2006 Apr 26
1
rake db_schema_dump make syntax error
rake migrate bug with datetime:
> rake db_schema_dump
produced a bad schema.rb that isn''t valid ruby, it has an invalid default, unless ruby
takes bare words:
t.column "date_available", :datetime, :default => Sun Jan 01 00:00:00 Arabic Standard
Time 2006, :null => false
I don''t think the Baghdad time zone should matter.
ruby 1.8.4, rails 1.1.2, MySQL 5.0.15, Win XP SP2
mysql> describe products;
+----------------+---------------+------+-----+------------...
2007 Oct 07
10
Rails to English
I am currently using the book "Agile Web Development With
Rails" (2005). I am working on a fully function web application that
has a shopping cart.
The web page displays this,
ActiveRecord::StatementInvalid in AdminController#create
Mysql::Error: #23000Column ''date_available'' cannot be null: INSERT
INTO products (`image_url`, `date_available`, `price`, `title`,
`description`) VALUES(''http://www.google.com/pic.jpg'', NULL, ''9.99'',
''asdf'', ''asdf'')
RAILS_ROOT: ./script/../config/..
Applicatio...
2005 Dec 31
2
Test Unit Problem
...I am experiencing the following test unit error working with Rails that
I can''t fathom.
I have a products.yml file which holds the following test fixture for
the products table:
dell_pc:
id: 1
title: Dell PC
description: Dell PC
image_url: http://.../pc_image.jpg
price: 15000.00
date_available: 2005-12-31 06:53:00
I also have the following product_test.rb file to test the fixture
above:
require File.dirname(__FILE__) + ''/../test_helper''
class ProductTest < Test::Unit::TestCase
fixtures :products
def setup
@product = Product.find(1)
end
def test_fixt...
2006 Mar 13
7
Wilcard search
Hello,
I''m writing a search function for my application, but I am unsure on how
to search for all results that contain my search string; here''s what
I''ve got:
def search
@products = Product.find(:all,
:conditions => "date_available < now()",
:conditions => [ "title ilike ?", @params[:search]],
:order => "title desc")
end
It works, but only if I provide a full match to the title - how can I do
"title ilike ''%''?''%'...
2006 Aug 13
1
Using ENUM column in table
...drop table if exists products;
CREATE TABLE products (
id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
sku varchar(6) NOT NULL,
price decimal(10,2) not null,
state ENUM (''kansas'',''georgia'', ''new york'') NOT NULL,
date_available datetime not null
) CHARSET=utf8;
Thanks,
Scott
--
Posted via http://www.ruby-forum.com/.
2006 Apr 21
2
NoMethodError with test_read_with_hash
...@product.id
assert_equal vc_book["title"], @product.title
assert_equal vc_book["description"], @product.description
assert_equal vc_book["image_url"], @product.price
assert_equal vc_book["price"], @product.price
assert_equal vc_book["date_available"],
@product.date_available_before_type_cast
end
Is there anything I need to tweak in the code to avoid seeing the error
again?
--
Posted via http://www.ruby-forum.com/.
2006 Mar 06
5
Rails MySQL query
Hi,
I?m following the Depot tutorial in Agile Web Development with Rails.
I need some help to display products thats in one specific category.
mysql> select * from products where category = "jackets" does what I
want, but I?m not sure how to make a list and display it in rails?
This code displays every product with some of its fields, but I want
it to only display the products
2005 Dec 30
1
Problems with Testing (Depot) demo app in Agile Rails book
...000/store) work any more. (See example error
message below)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ActiveRecord::StatementInvalid in Store#index
Mysql::Error: Lost connection to MySQL server during query: SELECT *
FROM products WHERE (date_available <= now()) ORDER BY date_available
desc
RAILS_ROOT: ./script/../config/..
Application Trace | Framework Trace | Full Trace
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract_adapter.rb:88:in
`log''
c:/ruby/lib/ruby/gems/1.8/gems/activere...
2006 Jul 05
0
@products = Product.find_by_sql "SELECT *...... "
...filter the collection by a date, but i dont know how to get the
values of a date, because i need that values to build my sql sentences
for example:
@products = Product.find_by_sql "SELECT * FROM products WHERE
cdbl(date_availabe) > " + first_date_double_value + " AND
cdbl(date_available) <= " + second_date_double_value
first_date_double_value & second_date_double_value
are the values that i dont know how to get
neither taking of Date.today value
please i need your help
tanks
--
Posted via http://www.ruby-forum.com/.
2006 Apr 20
0
Please help me !
...ind(params[:id])
@products = Product.salable_items1(params[:id])
flash[:notice] = "Succesfully"
end
I want to acess the varible that is in nthe product.rb file that is
model
def self.salable_items1(rid)
find(:all,
:conditions => "cat_id = rid",
:order => "date_available desc")
end
I am unable to access the variblein find method rid
How can access that variable..
Thnaks and regards,
Sure
--
Posted via http://www.ruby-forum.com/.
2006 Mar 11
1
unit testing date columns
...irst tests, following along the tute in Agile Web
Dev with rails book.
I have a table with a created_at timestamp column in mysql.
My test always fails when testing the result of the created_at column.
The book says my test should look like:
assert_equal "2006-03-09 21:01:37",
@thing.date_available_before_type_cast
but when I run my test I get 1 error returned:
"undefined method date_available_before_type_cast"
what am I doing wrong?
--
Posted via http://www.ruby-forum.com/.