I forgot to specify the primary key as rowid.

Thanks , Fred.

On Aug 5, 3:58 pm, Frederick Cheung <[email protected]>
wrote:
> On Aug 5, 8:44 am, pierr <[email protected]> wrote:
>
> >  Basic.find(:all , :select=>"rowid , event_name ,text ",
> >                    :conditions=>["rowid = ?",rowid]).each do |o|
>
> Is rowid your primary key (and if so have you told active record that
> it is) ? if not then your save is failing because you haven't selected
> the primary key. Also check that you don't have any failing
> validations
>
> Fred
>
>
>
> >                 puts "before modify"
> >                 puts  o.event_name
> >                 puts  o.text
> >                 o.event_name = "hello"
> >                 o.text = "world"
> >                 puts "after modify before save"
> >                 puts  o.event_name
> >                 puts  o.text
> >                 o.save
> >                 #o.update_attribute(:event_name,"hello")
> >         end
> >         #confirm
> >         Basic.find(:all , :select=>"rowid , event_name ,text ",
> >                               :conditions=>["rowid = ?",rowid]).each
> > do |o|
> >                 puts "after save"
> >                 puts  o.rowid
> >                 puts  o.event_name
> >                 puts  o.text
> >         end
>
> > output Log :
>
> > -->before modify
> >  |⒏Ⅲ罐る鸏1B2nrDJ0楦?6I!Aん赏发!!摅矿Eg!A?
> >  B?L1B2琂k楣|ん赏发贽罂驟g鶭6Ah,@d(:?}踌耷?>@7<T螥i?M駾6国L1B2M;OB騆\;X?c<T10?M?|楦?
> > I  r;O   a??c-DJNJ3F.rDI&?
>
> >  -->after modify before save
> >  hello
> >  world
>
> >  -->after save
> >  72
> >  |⒏Ⅲ罐る鸏1B2nrDJ0楦?6I!Aん赏发!!摅矿Eg!A?
> >  B?L1B2琂k楣|ん赏发贽罂驟g鶭6Ah,@d(:?}踌耷?>@7<T螥i?M駾6国L1B2M;OB騆\;X?c<T10?M?|楦?
> > Ir;Oa??c-DJNJ3F.rDI&?
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to