search for: created_at

Displaying 20 results from an estimated 611 matches for "created_at".

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 created_at with current time written to databas...
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 M...
2006 Apr 05
7
Archive monthly count for blog
I am creating a blog to learn ruby on rails. from the layout page i pass all the posts as a collection to _archive.rhtml <%= render :partial => "archive", :collection => @archive %> On _archive.rhtml i have access to the collection. I am then gone to render partial another page _archivecount.rhtml to display the number of posts for each month. Can anyone give a clue
2011 Oct 11
10
Create Two objects at the same time
I have user model and referral model. Referral model has user_id as field. Now when a new user is created, I need to call referral#create as well and pass it the id of the newly generated user to user_id of referral model. How can I do that. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2006 Jun 10
3
Weird Problem With Active Record
Is it me or is my model getting the created_at from the wrong model! I have a HABTM relationship between Problems and Tags. In one of my controller I do the following: def view @tag = Tag.find_by_name @params[:id] end In my view I do this: <% @tag.problems.each do |problem| %> ... <%= problem.created_at %>...
2006 May 27
0
Typo 1055 created_at Vs. published_at
...s might be on the subject? In Typo 1055, if you use the admin interface and change the published date for an article, you will get "post not found", when you click on the article in the user interface. I belive that the user interface should use the published_at date, instead of the created_at date. The admin interface only allows changes to the published_at date. Using the published_at date in the user interface gives you more control over your blog and how the articles are presented. Here are my suggestions: app/models/blog.rb line 140 def article_url(article, only_path = true,...
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...
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 Ce...
2010 May 11
1
has_one/belongs_to -- accessing the subordinate
...one :carriage, :dependent => :destroy private def create_carriage Carriage.create(:horse => self) end end class Carriage < ActiveRecord::Base belongs_to :horse end ============ This works fine using create: ======== >> horse1 = Horse.create() => #<Horse id: 5, created_at: "2010-05-11 16:17:06", updated_at: "2010-05-11 16:17:06"> >> horse1.carriage => #<Carriage id: 5, created_at: "2010-05-11 16:17:06", updated_at: "2010-05-11 16:17:06", horse_id: 5> ======== It also works if you call Horse.new(), horse.save!...
2006 Jul 17
1
acts_as_tree and :include
hello there, i have a model that uses acts_as_tree: >class GbEntry < ActiveRecord::Base > acts_as_tree :order => ''created_at DESC'' >end and i want it to paginate, including all children to avoid unnecessary db queries: > @gb_entry_pages, @gb_entries = > paginate :gb_entries, :per_page => 15, :order => ''created_at DESC'', :include => :children when i run that, i get the...
2010 May 25
1
find_by_sql timestamp parameter
Hi In controller I have this query: @price_stat = Price.find_by_sql("select id, cost, tour_id, unix_timestamp(created_at) from prices") when I try to display result''s created_at column I don''t have any results: <% @price_stat.each do |p| %> <p><%= p.created_at %></p> <% end %> result is empty But if I try without unix_timestamp. ie: @price_stat = Price.find_...
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 some horrendous dependencies. Now, the weird thing is that everyt...
2006 Feb 18
5
Date formatting error
...All I''m trying to do is format a date and I get an error. Details below. I have a partial to list all "notes" associated with a "client" with the following code. <% for note in @client.notes %> <hr /> <%=h note.note_text %> Posted on <%=h note.created_at.strftime("%I:%M") %> by <%=h note.created_by %> <% end %> Which gives me the error... |"You have a nil object when you didn''t expect it! The error occured while evaluating nil.strftime" When I remove the |.strftime("%I:%M") from note.create...
2011 Apr 27
2
Can not create model instance via params on specific model but can on others....
...del 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, success: nil, authorization: nil, message: nil, params: nil, created_at: "2011-04-27 18:18:59", updated_at: "2011-04-27 18:18:59"> But this works (but is ugly): (rdb:1) bpt = PaymentTransaction.new #<PaymentTransaction id: nil, purchase_id: nil, action: nil, amount: nil, success: nil, authorization: nil, message: nil, params: nil, created_at...
2007 Oct 05
13
spec''ing view render partial collection, local variable not found
...ib/spec/rails/matchers/have_text.rb:12:in `matches?'' ./spec/views/games/_game.rhtml_spec.rb:39: def before game = mock_model(Game, :name => ''The Battle for Blaze'', :salt_grains => 5000000, :people => 5000000, :days => nil, :created_at => "Mon Oct 01 00:02:44 -0400 2007", :enabled => true) game.should_receive(:name).and_return("The Battle for Blaze") game.should_receive(:salt_grains).and_return(5000000) game.should_receive(:people).and_return(5000000) game.should_receive(:days).and_...
2007 Nov 02
3
Date Issues + Oracle + RoR
Hi Experts I''ve a product like this ID -> 1 Name -> Xyz Price -> 30 Created_at -> 02-NOV-07 from_date = Date.new(2, 10, 07) to_date = Date.new(2, 10, 07) @product = Product.find_by_sql("select * from products where created_at between from_date and to_date") code works perfectly, buy my issue is i dont get any data. always says no record found but if i use as...
2007 Oct 25
1
find - group - postgres
I am not sure that this is entirely a rails question as I am trying to run the command in postgres and I am getting the same error... controller code... @client_slot_count = ClientSlotsDaily.find(:all, :conditions => ["created_at > ? AND created_at < ? AND facility_id = ? AND client_id IS NOT NULL", starting_date, ending_date, @facility.id], :group => ''client_id'') error reported is... PGError: ERROR: column "client_slots_dailies.id" must appear in the GR...
2006 May 07
2
Can I find what time the current session was created?
I want to get the time at which the current session was created. It doesn''t have to be exact - I''m not worried about the fact that a user may not actually be on, yet the session is still active. I''d just like to be able to do session.created_at
2005 Oct 24
3
bogus find_all in Rails 0.14.1
I have the following statement cl = ChatEvent.find_all("ev_type <> #{t} and chat_id = #{@params [:chat_id]} order by created_at") which produces the following error: #42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''order by created_at)'' at line 1: SELECT * FROM chat_event WHERE (ev_type <> 0 and c...
2009 Feb 23
2
to_json problem (Rails2.2.2)
Hi all, i got a record from my project server side database, like this : @user = User.find 1 then i cover @user to json format: @user.to_json the result : "created_at": "2009-01-28T12:29:32Z" what''s the T and Z of created_at field ? but i change Rails 2.2.2 to Rails1.1.6, I got : "created_at": "2009-01-28 12:29:32" this is a bug of the Rails2.2.2 ??? --~--~---------~--~----~------------...