Displaying 20 results from an estimated 72 matches for "updated_on".
2006 Apr 16
2
conditional updated_on update
Hi list,
I''ve got some counter_caches in a model. When these get incremented - say on
a page view - my updated_on column also gets updated. How can I
conditionally not update updated_on if just these counter_cache columns
change?
The problem with that is that I am using acts_as_versioned which clones the
record each time updated_on changes. I am successfully ignoring the
counter_cache fields in acts_as_versio...
2006 May 29
6
override automatic update of updated_on column
i know that title sounds confusing, but here is the deal:
the two columns that we are concerned with for this question are the "updated_on" column and the "views" column. the views column increases everytime a user visits a certain page. like this:
@object.update_attributes(:views => @object.views + 1)
the problem is that when a user visits the page, it AUTOMATICALLY updates the "update_on" column with...
2006 Apr 26
5
accessing created_on causes type error
I assume that this is some newbie stupidity, but I haven''t found my
way around this problem. I have an ActiveRecord object fetched
from the database, and I need to evaluate the contents of the
updated_on field. However, *any* attempt to access that data in the
program results in a TypeError with the message ''no implicit conversion
from nil to integer''.
cust = Customer.find(:first, :conditions => ["custid = ?", custid]
if cust.updated_on.nil?
...never gets here
en...
2006 May 24
1
AR many-many join tables - can they have created_on, updated_on ?
Hello all,
I''m creating a many-many join table between ''homes'' and ''users''. Can it
contain created_on? will AR update created_on, updated_on on this table?
CREATE homes_users (
home_id int not null,
user_id int not null,
created_on datetime null,
updated_on datetime null
)
Thanks for your advice!
--
------------------------------
Apple MacBook. Black. It''s the new White!
------------------------------
Peter Fitzgibbons
--...
2006 May 31
3
detecting changed data
I am working on an application where there are many different screens to
access the data in a particular record/row. I have links to each data
entry screen at the top. Is there a way to detect whether the current
hash has been changed from the stored record so I can prompt the user if
they attempt to change screens without having saved their changes to the
data?
Craig
2005 Dec 27
3
created_on & updated_on - helper to display date only
All,
My initial list is rather busy. I would like to shorten the
created_on and updated_on fields to just display the date, not the
time. Best wold be a simple 12/28/05 type of presentation.
I''ve found the format helpers in rdoc. (ie.
distance_of_time_in_words_to_now ), but none seem to be what I''m
looking for.
How do I control the date format of a timestamp field?...
2005 Dec 22
3
help with unless
Hi,
I need a fresh set of eyes to look at this bit of controller code and tell
me why I might be getting an error message:
lookup = Profit.find(:all, :conditions => [ "user_id = ? AND
product_id = ?", uid, pid])
unless lookup.empty?
if (lookup.updated_on > 360.minutes.ago)
return
end
end
If lookup is empty, then I get an error message that
lookup.updated_ondoesn''t exist. I''ve tried
lookup.nil? but lookup gets returned in the form of [] so that empty works.
But if lookup is empty should not t...
2006 Apr 25
4
Newbie - Grouping of items...
...ages, comments, lists etc) an enrty gets added
to the log along with the project. I can see this being an overkill and
the duplication of data is not correct.
(2) In my controller perform a query that searches every model for every
item against a given project_id. The order the results by "updated_on".
Then select the last 5 for each result. This seems really complicated
and perfoms many SQL queries
Does rails/ruby have a better way of achieving this? What have you done
in your projects that works reliably and quickly?
Many thanks
--
Posted via http://www.ruby-forum.com/.
2005 Dec 19
3
created_on, created_at defaulting to 2000/01/01 00:00:00
Hello all,
Rails 1.0.0
created_on is being set to 2000/01/01 00:00:00
Any ideas on this ?
Thanks!
Schema is
create table user_login_history (
id int identity(1,1) not null,
user_id int not null,
created_on datetime default(getdate()) not null,
created_at datetime default(getdate()) not null,
updated_on datetime default(getdate()) not null,
constraint pk_user_login_history primary key clustered (id),
constraint fk_user_login_history_users foreign key (user_id) references
users(id)
)
ruby script/console
>> Time.now
=> Mon Dec 19 14:39:53 Central Standard Time 2005
>> ulh = UserLogin...
2007 Aug 14
1
find_by_sql vs connection.select_all
I was trying to do SUM based mySQL query simliar to the following:
SELECT SUM(updated_on - created_on) AS total from signups
If I were to run this command in the mySQL console I would get a
result. However, if I were to run it using the following command in
Rails:
Signup.find_by_sql("SELECT SUM(updated_on - created_on) AS total from
signups")
The query that is written to...
2006 Apr 14
4
Newbie stuff (.new method)
Hi-
Ruby 1.8.2 Rails 1.1
so I''m trying to build my first rails app and I''m trying to understand
how the helper methods work. For instance .new & .save . For instance,
I''ve created a table of Objects, and generated a scaffold. I see that
in the controller, there are calls to Object.new and Object.save. I''m
assuming that these are methods inherited
2007 Mar 17
4
Created_on and updated_on in a non-ActiveRecord model
...g an ActiveRecord model, according to the tips
stated in [1]. It is simulated because even though I am gonna save the
attributes in a file, not in a DB, I still want the validations made by
ActiveRecord::Base (see code below).
Well, the thing is that I also want the behaviour of the created_on and
updated_on columns, that get modified automatically before saving.
The problem is that I have my own "save" method and it does not work
(remember this is not a real ActiveRecord model). I''ve tried to set the
before_create and before_updated methods but they does not work (see
code below)....
2008 Jun 16
2
call_backs Is it?
Hi
I have the models
1.ServiceDeskTicket with fields
id --- number --- service_desk_status_id -- created_on -- updated_on
etc
2.ServiceDeskActivity with fields
id -- service_desk_ticket_id -- description -- created_on --
updated_on
3.ServiceDeskAttachment
id -- service_desk_ticket_id -- attachment -- created_on --
updated_on
Relations as
ServiceDeskticket has_many service_desk_activities
Service...
2005 Dec 23
4
OO model style: inheritance
...e to add more features in future I am trying
to design a clean OO architecture of my models:
The base object should be NODE. All other objects
extend NODE, those are GALLERY and IMAGE (a GALLERY
consists of 0..* IMAGEs). Each NODE has an owner
(user_id) plus some default fields like created_on and
updated_on. Futhermore there is an object COMMENT
which can be attached to any object that extends NODE
(belongs_to NODE).
According to this design I modeled the db schema as
follows:
CREATE TABLE `nodes` (
`id` int(11) NOT NULL auto_increment,
`user_id` int(11) NOT NULL default ''0'',...
2006 Jun 20
3
find ''newest'' of a model
I have a model which has the created_on and updated_on fields. I would
like to find the newest instances of my model from the database(for
instance, last 10), but as I''m only 6 weeks into my Rails development, I''m
not entirely sure how to do it. Any suggestions?
Thanks,
David
2005 Dec 31
0
Disabling updated_at/updated_on
Hello
Is it possible to disable the update of "updated_(at|on)" columns when
using acts_as_list methods for example ?
Thanks
2005 Dec 27
3
Trouble combining :has_many, :finder_sql and :conditions to create a sub-search
...:dependent => true,
:finder_sql => ''SELECT DISTINCT p.*
FROM people p
WHERE (p.works_for_id = #{id} OR
p.shops_at_id = #{id})'',
:order => "updated_on DESC"
end
Meanwhile people is an STI:
class Person < ActiveRecord::Base
end
class Employee < Person
belongs_to :store,
:foreign_key => ''works_for_id''
end
class Shopper < Person
belongs_to :store,
:foreign_key => ...
2006 Jan 05
3
ActiveRecord setting IDs on auto increment fields
...ecord shouldn''t need to force a value, no?
the table looks like this:
CREATE TABLE `industries_risks` (
`id` int(10) unsigned NOT NULL auto_increment,
`industry_id` int(10) unsigned default NULL,
`risk_id` int(10) unsigned default NULL,
`created_on` datetime default NULL,
`updated_on` datetime default NULL,
PRIMARY KEY (`id`)
) TYPE=InnoDB;
the code in question is almost directly ripped from this tutorial:
http://jrhicks.net/Projects/rails/has_many_and_belongs_to_many.pdf
def update
...
if @params[:risk_id]
@industry.risks = Risk.find(@params[:risk_id]) if @pa...
2006 Jun 13
2
four days on rails - nil object when you didnt expect it
...sing the issue not all of
it)
<% for category in @categories %>
<tr>
<td><%= category["category"] %></td>
<td><%= category["created_on"].strftime("%I:%M %p %d-%b-%y") %></td>
<td><%= category["updated_on"].strftime("%I:%M %p %d-%b-%y") %></td>
<td><%= link_to ''Edit'', :action => ''edit'', :id => category%></td>
<td><%= link_to ''Delete'', {:action => ''destroy'', :i...
2005 Dec 25
3
SQLite primary key schema
...;'id'' column, which breaks all kinds of things.
Take as an example my ''users'' table. In Postgres the schema is
(generated with pgAdmin III):
CREATE TABLE users
(
id serial NOT NULL,
login varchar(80),
"password" varchar(255),
created_on timestamp,
updated_on timestamp,
avatar varchar(255),
CONSTRAINT users_pkey PRIMARY KEY (id)
)
WITH OIDS;
ALTER TABLE users OWNER TO george;
Everything works just dandy until we cross over to the SQLite world:
CREATE TABLE users (
id serial NOT NULL,
login character varying(80),
"password" cha...