Hi All, I have created a table "record_archives" using engine=archive in my application to archive data for a table "records". I want to insert data into archived table at specific time, like once in a week. I have created model for that table but not used any migration and directly created a table using script. The script includes default value for id is ZERO and Initially there is not a single entry in both tables. When i creates a record using RecordArchive.create(:id=>rec.id, ...), it inserts ZERO into archive table even though i have passed an id for that record. And i am not sure why it doesn''t insert the value for id into archived table? Please somebody can answer my question, How to insert the value for id? Is there any other way to insert the actual value of ID? Do i need to use any other way to insert the data into archived table as Rails models may be using index and which is not supported in archive engine? Thanks, Manohar. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 9 Jan 2009, at 13:14, manohar amrutkar wrote:> > Hi All, > > I have created a table "record_archives" using engine=archive in my > application to archive data for a table "records". I want to insert > data into archived table at specific time, like once in a week. I have > created model for that table but not used any migration and directly > created a table using script. The script includes default value for id > is ZERO and Initially there is not a single entry in both tables. > > When i creates a record using RecordArchive.create(:id=>rec.id, ...),The id column is protected from mass assignment. At the very least you''d have to do something like foo = Foo.new foo.id = 123 foo.save! Fred> > it inserts ZERO into archive table even though i have passed an id > for that record. > > And i am not sure why it doesn''t insert the value for id into archived > table? > > Please somebody can answer my question, How to insert the value for > id? Is there any other way to insert the actual value of ID? Do i need > to use any other way to insert the data into archived table as Rails > models may be using index and which is not supported in archive > engine? > > Thanks, > Manohar. > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks Frederick Cheung !!! On Jan 9, 6:49 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 9 Jan 2009, at 13:14, manohar amrutkar wrote: > > > > > Hi All, > > > I have created a table "record_archives" using engine=archive in my > > application to archive data for a table "records". I want to insert > > data into archived table at specific time, like once in a week. I have > > created model for that table but not used any migration and directly > > created a table using script. The script includes default value for id > > is ZERO and Initially there is not a single entry in both tables. > > > When i creates a record using RecordArchive.create(:id=>rec.id, ...), > > The id column is protected from mass assignment. At the very least > you''d have to do something like > foo = Foo.new > foo.id = 123 > foo.save! > > Fred > > > > > it inserts ZERO into archive table even though i have passed an id > > for that record. > > > And i am not sure why it doesn''t insert the value for id into archived > > table? > > > Please somebody can answer my question, How to insert the value for > > id? Is there any other way to insert the actual value of ID? Do i need > > to use any other way to insert the data into archived table as Rails > > models may be using index and which is not supported in archive > > engine? > > > Thanks, > > Manohar.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---