Displaying 20 results from an estimated 2000 matches similar to: "override created_on column name"
2007 Mar 17
4
Created_on and updated_on in a non-ActiveRecord model
Hi you all,
I have a model simulating 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
2006 Mar 26
5
How to write manage created_on and created_by via mixin?
Hi!
Definite newbie here - I''m working through this like-hate relationship with
Ruby and Rails right now... sometimes things work really well (like blobs
seem to rock) but other times, I dunno! :-)
Anyway, I''d like put in create and update user timestamps on all my primary
domain tables and allow them to be updated automatically by ActiveRecord.
Coming from Hibernate, I just
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
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.
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 =
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?
Thanks
2006 Jul 25
3
Ruby hangman (was Re: List etiquette question)
"Beast" is more appropriate than you know. It''s definately Frankenstein
code. (read: it ain''t pretty, but it works - some of the time). Anyway, it
entertains my wife; not sure if hardcore programmers will get anything out
of it or not.
You might find it interesting (or pointless) that in a complete
bastardization of rails'' main reason for being it
2006 Jul 13
4
script injection/cross-site scripting protection
When is it possible to set <script>while(true){}</script> as the value of
project.name, what it the best way to escape the output of the following?
<td><%= project.name %></td>
Dennis Byrne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060713/bbdedb86/attachment.html
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 the log is:
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
2005 Dec 23
4
OO model style: inheritance
Hi everybody
I am totally new to rails and I am trying to start a
tiny project to get familiar with rails. But I already
got my first problem and I would be happy if somebody
could point me in the best and cleanest direction.
I am trying to develop a small gallery app. Since I
would like to add more features in future I am trying
to design a clean OO architecture of my models:
The base object
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
2006 Jun 13
2
four days on rails - nil object when you didnt expect it
Hi all,
Im trying to get my head around rails and to help along Im working
through "four days on rails" as this seems to give a good real world
example with multiple tables and relationships (the main thing I cant
work out!)
Ive got stuck. Some help would be really good here.
The controller has this code:
def list
@category_pages, @categories = paginate(:category, :per_page =>
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
2006 Jan 05
3
ActiveRecord setting IDs on auto increment fields
Hi All, I''ve tried to do my searches, but can''t find reference to
this anywhere - My question is about ActiveRecord inserts and IDs. I
have a join table that both the models of the source tables join with
"has_and_belongs_to_many". It seems like ActiveRecord is setting the
"id" field for the join table- This should be an auto_increment and
2005 Dec 25
3
SQLite primary key schema
So after successfully getting the test SQLite db to run from memory, I
tried running some tests but found that somewhere in the schema
translation from Postgres (my devel database) and SQLite Rails fails
to properly set the ''id'' column, which breaks all kinds of things.
Take as an example my ''users'' table. In Postgres the schema is
(generated with pgAdmin III):
2006 Feb 23
4
MySQL Duplicate Key Error
I am a newbie and I am running into a problem which I cant understand. I
have a table called ''privileges'' which has the following fields
CREATE TABLE `sdqualplanner`.`privileges` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(20) NOT NULL default '''',
`description` varchar(100) NOT NULL default '''',
`section_id`
2005 Oct 28
2
Accessing fixture
I have a very simple problem. I can''t seem to access
a the fixture by name
I have a sites.yml with:
simple_site:
id: 1
name: demo
description: A demo site
created_on: 2005-10-25 00:00:00
updated_on: 2005-10-25 00:00:00
And I have a test class as:
require File.dirname(__FILE__) + ''/../test_helper''
class SiteTest < Test::Unit::TestCase
fixtures
2006 Jun 28
20
Rails Vs JBoss Seam
I have been frustrated with J2EE technology just like any other developer who has worked in that
technology for a long time. This made me learn about Rails and I was excited about RoR. Today I
came across JBoss Seam framework and I am not able to contain my excitement.
My passion for JEE development is back. It seems like it is better than RoR. I would like to hear
differnt opinions about this
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