similar to: ActiveRecord setting IDs on auto increment fields

Displaying 20 results from an estimated 1100 matches similar to: "ActiveRecord setting IDs on auto increment fields"

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
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
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
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 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 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 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 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 Feb 20
1
belongs_to, has_one, has_many question (again?)
Hi All, Probably this has been asked numerous times, I apologize already! Can somebody point me to a good tutorial on how Rails works with relations? I know about database design and normalization, I also know about programming in general (and OOP for that matter). Only thing I can say is that I''m following the "Four days on Rails" tutorial by John McCreesh. He writes
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 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
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 Jul 28
3
Help troubleshooting save
I done plenty of saves before in rails, but I must be missing something simple with this. Can a fresh set of eyes take a look at this and see why it is not saving: def addcash(uid) c = Trade.new c.attributes = {"user_id" => uid, "tradetype" => ''9'', "cash" => 10000} breakpoint if
2006 Mar 24
1
Has and belongs to many ... howto in the view?
I have a project, it has members. I have the data modeled, the ActiveRecord setup but I''m running into a block as how to accomplish this in a view. I would like if when the Project is being edited to present a list of all users, and then have a checkbox beside each name. Those selected would be a member, those who are not, obviously would not be. I am, however, not closed to
2010 Sep 16
5
vestal_versions -- can I set it to ignore certain columns?
I''d like my published boolean to be excluded from the calculation as to whether a version is created or not. Can anyone suggest a way to do that? Thanks, Walter -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To
2007 Dec 17
3
not able to view the images after the upload
hi, i have this problem where in i''m able to upload the images using file_column to the server but i''m not able to view the images.i''m not able to see the images but then i''m able to view the image name when i click on my show action. can any one please help?? THIS IS MY LOG as to what happens when i do the image upload. Processing UploadController#create
2006 Mar 26
3
Making a custom selection form - newbie
Hello all, I''ve been working with Ruby on Rails for a few weeks now. It''s difficult for me because I don''t have much experience with Ruby, Rails, MySQL, or any other web-languages. But I''m trudging on and learning a lot. I''ve been working on a web application for my dad''s website; it''s a simple content manager for
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
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