Forum: Ruby on Rails How can i know weather a record is saved or not?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5faa716c5099281dfc924c8ea362d90f?d=identicon&s=25 --- Z@m --- (Guest)
on 2009-03-06 06:20
(Received via mailing list)
after creating a new record of a model , using new() is there any way
to know weather an record is saved to dataabase of is it still in
"new" state ?
661ae6e97d0e16c2af2aaf7d197e8387?d=identicon&s=25 Sijo k g (sijo)
on 2009-03-06 06:27
 creating a new record of a model , using new() does not save it to
database until called save
Af10464d988bde1b15b1a324237bad84?d=identicon&s=25 Dharmdip Rathod (dharmdip)
on 2009-03-06 08:17
Sijo Kg wrote:
>  creating a new record of a model , using new() does not save it to
> database until called save

recrod.save? will return Boolean.
5faa716c5099281dfc924c8ea362d90f?d=identicon&s=25 --- Z@m --- (Guest)
on 2009-03-06 10:53
(Received via mailing list)
> record.save? will return Boolean.

i just want to know weather it is saved ? i don want to save it or try
to save it !
80e4cb97cae5c8d745f72337d93fd8f2?d=identicon&s=25 MaD (Guest)
on 2009-03-06 10:59
(Received via mailing list)
> i just want to know weather it is saved ?
> i don want to save it or try to save it !

well, if you dont try to save it, the answer to your question is quite
easy: no.
9b8d00f99fe595bdc45fd30439cf9c8f?d=identicon&s=25 Franz Strebel (Guest)
on 2009-03-06 11:03
(Received via mailing list)
On Fri, Mar 6, 2009 at 10:52 AM, --- Z@m ---
<krishnaprasadvarma@gmail.com> wrote:
>
>> record.save? will return Boolean.
>
> i just want to know weather it is saved ? i don want to save it or try
> to save it !

You can do record.new_record? to check if it is a new record
5faa716c5099281dfc924c8ea362d90f?d=identicon&s=25 --- Z@m --- (Guest)
on 2009-03-06 12:08
(Received via mailing list)
> You can do record.new_record? to check if it is a new record

Thank you
thats what i want !
B7cdfb10784a567f76f3cb79d531cd4c?d=identicon&s=25 torm3nt (Guest)
on 2009-03-06 21:41
(Received via mailing list)
In order to get the right answer, you usually have to ask the right
question ;)


On Mar 6, 10:07 pm, "--- Z@m ---" <krishnaprasadva...@gmail.com>
This topic is locked and can not be replied to.