search for: created_on

Displaying 20 results from an estimated 145 matches for "created_on".

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()...
2005 Mar 09
21
Converting time retrieved from MySQL
I''m having a problem converting a date retrieved from my MySQL database and I''m hoping someone can help. MySQL stores the date/time as this: 2005-03-08 17:00:34.0 and according to my Pickaxe book Ruby stores times as "the number of seconds and microseconds since [...] January 1, 1970". All well and good. Unfortunately, RoR is converting my date to this:
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! -----------...
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
2006 Mar 23
1
YAML inconsistencies...
...d this junk started. I''ve outlined the problem in two pastes, which I''ll paste below. ----1 ### This was already saved in my database, pre 1.8.3 -> 1.8.4, and pre Rails 1.1RC1 >> c.lawsuit.customer_service_location => "--- !ruby/object:Address \nattributes: \n created_on: 2006-02-24 12:30:19\n city: Alex City\n line1: 441 Saint Bernard Drive\n zip: \"35086\"\n line2: ''''\n id: \"124\"\n contact_detail_id: \"128\"\n detail_key: Home Address\n state: AL" ### And I created this YAML object from the same data...
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 tim...
2006 Apr 20
5
Noobie problems with helper
...in application_helper.rb: def format_date(date) day = to_s(date.day) month = to_s(date.month) time = to_s(date.time) date = day + "/" + month + " - " + time return date end I am trying to call this method in a view like this: <%= format_date(bounty.created_on) %> create_on is a timestamp in mysql. I am getting this error: ArgumentError in Bounties#index Showing app/views/bounties/list.rhtml where line #14 raised: wrong number of arguments (1 for 0) Extracted source (around line #14): 11: <tr> 12: <td><%= bounty.bounty %>&lt...
2006 Mar 31
2
A.R. Associations problem
...by creating a simple forum that consists of 3 tables: ahuthors, topics and posts. This is the schema: class AddAuthorAndTopicAndPostTables < ActiveRecord::Migration def self.up create_table :authors do |t| t.column :username, :string t.column :email, :string t.column :created_on, :datetime end create_table :topics do |t| t.column :topic, :string t.column :author_id, :integer t.column :created_on, :datetime end create_table :posts do |t| t.column :post, :text t.column :topic_id, :integer t.column :author_id, :integer...
2005 Dec 23
4
OO model style: inheritance
...nce I would like 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 ''...
2006 Jul 05
1
created_on in HABTM table getting parent dates
All of my HABTM tables receive the parent created_on/last_update_on dates whenever a record is inserted into these join tables. I don''t have any defaults in the database or anything else populating these tables. I assumed rails would populate these automagically. Is there something that needs to be done to get this to populate with th...
2006 Jul 05
3
override created_on column name
We are using Rails for a project that must integrate with a legacy database. Is there a way to get Rails to automatically set the timestamp for a column named something other created_on or updated_on ? Also, how does one manipulate the size of the database connection pool? Dennis Byrne -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060705/6a2465e9/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:...
2006 Jan 06
4
"Selecting" a calculated row / Using :select in the paginate method
Hi, I was trying to use the :select parameter to select a calculated row, but it appears that the parameter is not picked up by the paginate method. I want to add the following to the select statement: timediff(now(), created_on) as age So I tried: @story_pages, @stories = paginate :stories, {:per_page => 10, :include => ''user'', :select => ''timediff(now(), story.created_on) as story_age''} ... to no avail. I know I can create a method named "age" for the story mode...
2007 Mar 17
4
Created_on and updated_on in a non-ActiveRecord model
...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 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...
2006 Jan 30
3
Howto change @article.article.headline to @article.headline ?
I have to actions: def index @articles = Article.find(:all, :conditions => "un_published != ''1''", :order => "created_on desc") end and def group id = params[:id] @articles = ArticleGroup.find(:all, :include => [:group, :article], :conditions => ["articles.un_published != ''1'' and groups.id = ?", id], :order => "articles.cre...
2006 Jan 26
9
Problem with schema_db_import on Site5?
...onds to your MySQL server version for the right syntax to use near ''(14)) ENGINE=InnoDB'' at line 1: CREATE TABLE channelposts (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `channel_id` int(11) DEFAULT 0 NOT NULL, `post` varchar(255) DEFAULT '''' NOT NULL, `created_on` datetime(14)) ENGINE=InnoDB /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract_adapter.rb:88:in `log'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:180:in `execute'' /usr/lib/ruby/...
2005 Mar 10
10
Some Basic Questions
Sorry I can''t access IRC from work so I hope you don''t mind me asking my newbie questions here: 1) I have the following code: @post = Post.find(@params[''id'']) @comments = Comment.find_all "post_id = #@params[''id'']", "created_on ASC" And I am have problems with the second line. I want to pass the id from my post to the comments line to get the comments for that post. What am I doing wrong? I tried a ton of different ways and they all don''t work 2) Does Routes work with Apache because I am running into so...
2006 May 03
6
ActiveRecord and Lost Connection
...eads and thought that might cause the issue, but I removed the threading out of it, so no dice there. Word: a Count: 270 ERR: invalid process URL state Mysql::Error: Lost connection to MySQL server during query: SELECT * FROM numbers_feed_links WHERE ( parsed = ''0'') ORDER BY created_on desc Here is kind of a unit-test # # Berlin Brown # Used to test active record connection # Run with: # # ruby connect_db.rb # require ''active_record'' require ''logger''; # Use the following to reformat the logging message: # class Logger; def format_message(s...
2006 Jun 13
2
four days on rails - nil object when you didnt expect it
...=> 10, :order_by -> ''category'') end and the view has this (just the bit thats causing 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%></t...
2006 Jun 11
2
Easy created_at/created_on question
I have an easy question that I can''t seem to find an answer to. When I have a table with a created_at or created_on column I''ve read that Rails will automatically update these because they are "magic" column names. I assumed that since this was all supposed to be done in the background that these columns would not show up in the standard forms that are created by the generate scaffold command...