Displaying 20 results from an estimated 20000 matches similar to: "Created_at date/time if off by UTC-5 hours ?"
2006 Mar 17
3
RoR problems with Created_At and PostgreSQL
So, I wrote some pages which essentially created some articles which are
saved to a database, which also include both the "magic" rows
''created_at'' and ''updated_at''.
Now, on my development machine I''m running the MySQL-database and
everything worked as I wanted it to. On the live server I''ve had to
switch to PostgreSQL 8.1 due to
2010 Jul 19
1
How to write your own created_at/updated_at?
I''m using Pfeed(http://github.com/parolkar/pfeed) plugin for User
Activity Feeds.
It creates PfeedItem model records and uses created_at field for a lot
of stuff inside.
Now I need to export/import those user logs. I do exporting to YAML.
When I reconstruct PfeedItem AR object from YAML, it have real(old)
creation time in created_at attribute. When I save this PfeedItem -
there is new
2010 Dec 13
9
created_at, updated_at and MSSQL
Hello,
I am running into a little issue. There is a considerable time
difference between the time that the console is giving me and the time
I am seeing in the created_at and updated_at column in the DB. The
difference is about 5 hours.
I don''t think the problem is in the DB, but I could be wrong.
Am I missing something obvious? Any clues?
--
You received this message because you are
2007 Sep 24
3
Oracle Date + RoR
Hi Experts,
I''ve a model called Product where i''ve column called created_at,
updated_at
where i''ve made a query based on Oracle date format
like
date_of_created = ''23-SEP-07''
@product = Product.find(:all, :conditions => ["created_at=?",
date_of_created])
but in view its empty.
AND EXPERTS I''VE DATA WITH 24-SEP-07 FOR MORE
2010 May 11
1
has_one/belongs_to -- accessing the subordinate
With a has_one/belongs_to relationship, what''s the best way to guarantee
that the belongs_to object gets created and is accessible alongside the
has_one object? I *think* the after_create callback is a good choice,
but I discovered an oddity while trying it.
F''rinstance, if every horse has a carriage:
============
ActiveRecord::Schema.define do
create_table(:horses) {|t|
2009 Nov 06
0
Nested objects not propagating from view
I thought I had this fixed, but apparently not. It works okay from the
console, but not from the view. I have the following:
# partial schema
create_table "users", :force => true do |t|
t.string "login", :null => false
t.string "first_name"
t.string "last_name"
t.string "email", :null => false
2009 Feb 11
6
Sessions do not update created_at column?
Hi All,
I added a column to the sessions table called "created_at" in order to
allow the created time to be recorded.
However, different from other Models, the column does not update
automatically.
Therefore, what codes should I add to update the sessions."created_at"
value?
It is important for avoiding hacker keeping the sessions alive.
Thanks much!
Arthur
--
Posted via
2008 Jan 12
1
Collection_Select not showing Selected option
Hi, I''m having some problem with getting collection_select to return
the current value when editing a record. According to everything I''ve
seen, there was an issue but it''s been fixed, but I can''t figure out
why it isn''t returning the current value as a selected option. I''ve
checked the table structures, and both the call_driver.product_line_id
2012 Apr 17
6
ActiveRecord with different Date/Time format
I have an application where user sets his/her preferred date/time
format. User is expected to enter datetime in his preferred format
across the application. Now the problem is for few formats the datetime
is parsed wrongly while create/update ActiveRecord.
For example user has set date/time format in hh:mm dd/MM/yyyy. Now if
user enters 17:00 04/05/2012 it parses it as 5 PM 5 Apr, 2012 where it
2009 Apr 29
1
Different behaviour on ActiveResorce with JSON or XML
I''m doing a request from a Rails app to another Rails app with
ActiveResource.
When the format on ActiveResource is XML:
Content.find(:all)[0,2].map(&:attributes)
=> [
{"updated_at"=>Mon Apr 27 15:04:32 UTC 2009,
"url"=>"www.google.com", "id"=>1, "created_at"=>Mon Apr 27 15:04:32
UTC 2009},
2008 Oct 06
1
Rails console, saving objects
I was reading a book and following the instructions in it.
>> class Story < ActiveRecord::Base; end
=> nil
>> story = Story.new
=> #<Story id: nil, name: nil, url: nil, created_at: nil,
updated_at: nil>
>> story.class
=> Story(id: integer, name: string, link: string,
created_at: datetime, updated_at: datetime)
I do not remember me asking for id, name, link or
2011 Apr 27
2
Can not create model instance via params on specific model but can on others....
Anyone have an idea on this? Got a weird situation where on a specific model
I can not create an instance using params, yet it works fine on other
models. The model which does not work is a stock model, there is no logic in
it. Ruby 1.8.7/Rails 3.0.5.
Does not work:
(rdb:1) PaymentTransaction.create(:purchase_id => 3)
#<PaymentTransaction id: 2, purchase_id: nil, action: nil, amount: nil,
2009 Apr 15
2
Getting Started with Rails - post_comment_url
Hi,
Thanks for a wonderful Getting Started with Rails. I am up to the last
section and just added the comments part.
So while testing and looking over comments_controller.rb;
I see the reference to post_comment_url calll where is this defined.
Below is the message I am getting.
Thanks
ActionController::RoutingError (post_comment_url failed to generate
from {:post_id=>#<Post id: 1, name:
2006 Jan 07
1
How to DRY with Fixtures (helper or extend Time class, how)?
I have a test/fixtures/users.yml like so:
apa:
id: 1
username: apa
[...]
created_at: <%=Time.now.strftime("%Y-%m-%d %H:%M:%S")%>
updated_at: <%=Time.now.strftime("%Y-%m-%d %H:%M:%S")%>
I don''t like how I''m repeating myself with the strftime bit.
Is there some shorter Time method to format time for a (MySQL) datetime
field that
2007 Aug 03
0
acts_as_paranoid and Association Extensions (has_one troubles)
Hi... Isn''t there a proper way or hack/workaround for the following?
* For the example with unfortunate disabilities.. look below,,,
Usage of has_* (associationmethods) do {def with_deleted
AccociatedModel#with_scope} {Paranoid''s#find_with_deleted}...
The has_one associations give me a nil object when invoking it with
Model.association_OBJECT.with_deleted. Has_many does like
2007 Nov 14
1
has_many_polymorphs and acts_as_list ?
First, BRAVO for this wonderful plugin: has_many_polymorphs ! Now my
problem:
4 models : Collection, Page, Fragment, Belonging (which is the join
table):
1 class Collection <
ActiveRecord::Base
2 has_many_polymorphs :elements,
3 :through => :belongings,
4 :from => [:pages, :fragments, :collections],
5 :as => :collector,
6 :parent_order =>
2010 Mar 08
2
calling save changes a date field in my model instance to 2000
Hi,
I''m having a problem with dates (laugh if you must :).
$ rails --version
Rails 2.3.5
$ ruby --version
ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
I have a bunch of data in a text file that I''d like to place in my
DB but am ending up with odd results when I save the data.
Here''s my model:
class CreateWaits < ActiveRecord::Migration
def
2010 Mar 16
6
SQL result to String conversion
Hello All,
I am very new to Ruby on Rails and I have a quick question for you all,
which is as follows:
I have this following line of code in an partial that renders itself on
the posts/index view:
Created By (User): <%= User.find(:all, :select => ''name'', :conditions =>
["id = ?", 1]) %>
(I am hard-coding that ''1'' there)
Now, when I run
2009 Aug 28
0
Nil object nightmare
I''m having a real problem with nil objects in a view I''m playing with.
if I type ...
<%= debug lesson.lesson_register.attendees %>
I get the following displayed in the browser ....
- !ruby/object:Attendee
attributes:
enrollee_id: "25"
created_at: 2009-08-27 15:10:41
updated_at: 2009-08-27 15:10:41
id: "1"
attended: f
2009 Jul 08
0
accepts_nested_attributes_for and has_one
Hi all, I''m seeing some unexpected behaviour in a nested model and I''m
not sure if it''s a bug or if I''m doing something wrong. When
assigning nested attributes, the associated object gets replaced with
a new record.
Example code:
class Car < ActiveRecord::Base
belongs_to :driver
end
class Car < ActiveRecord::Base
belongs_to :driver
end