Displaying 6 results from an estimated 6 matches for "curdat".
Did you mean:
curdag
2006 Feb 15
1
Per Database Migrations
Is there away to have parts of a migration file only work with a specific database. For example I am inserting some data into a table with:
execute "INSERT INTO demo_lists(position, name, updated_at, created_at) VALUES (1, 1, ''scott'', CURDATE(), CURDATE());"
Of course the curdate() function may only be available on mysql. So can we some how determine which database type Migrations is working on? I would assume there''s away since my Migrations class extends ActiveRecord.
thanks, scott.
-------------------------...
2005 Dec 08
2
Confusing lock problem in rails
...end
[count, docs]
end
def mark_as_viewed(user_id)
# user = self.users.find(user_id)
end
def self.delete_old
@p = Pref.find_by_setting(''autodelete'')
if @p and @p.value.to_i > 0
val = @p.value.to_i
destroy_all(["found_on <= DATE_SUB(CURDATE(), INTERVAL ? DAY)", val])
end
end
def self.delete_before(params)
date = sprintf("%04d-%02d-%02d", params[:foundon][:year],
params[:foundon][:month],
params[:foundon][:day])
deleted = Resume.d...
2006 Jul 25
6
Subtract a field from the current time in MySQL?
I have the following:
Table Products:
With a column called "purchased_at" of type "datetime".
Products.find(:all, :conditions => ["? - purchased_at >= 120",
Time.now])
Why doesn''t that work? What I''m trying to do is find records that were
purchased less than or equal to 2 minutes ago.
Thanks for your help.
--
Posted via
2006 Jun 22
4
Filter on variable
Hi all,
I have a question about filtering on a variable.
If I have the following code in my controller to select a list of
users
> @allusers = User.find(:all,
> :conditions => [''team_id = ?'', @params["id"],
> :order => ''created_at'')
Is there an easy way to find out all users who
2006 Jan 08
2
Why is my record readonly=>true?
...sid,
subjects.name,gaps.id as gid, gaps.gap",
:joins => "left join (subjects,gaps) on
(bits.subject_id = subjects.id and bits.gap_id = gaps.id)",
:conditions => "bits.status=''a'' and
next_review <= CURDATE()",
:order => "gap,next_review,subject_id,bits.id")
end
But when I try to save it rails complains that it is read-only. this
is true, I can see that from the @bit.inspect I put in my view. But
what is the cause?
Any help, much appreciated.
br...
2006 May 04
3
Date find help please.
Here''s my problem.
I have an ''Item'' model with a date column called "inserted_on" formatted as
"yyyy-mm-dd hh:mm:ss:t". I want to find all records that were inserted more
than 30 days ago. How would I say that using the Item.find ( :all .....)
method? I don''t fully understand the syntax. I tried
@result = Item.find( :all, :conditions =>