Forum: Ruby Re: sequel error handeling

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.
7749ad2349fdbe33b052aebf30e254ff?d=identicon&s=25 spox (Guest)
on 2009-05-31 22:43
(Received via mailing list)
On Sunday 31 May 2009 05:44:54 am jeljer te Wies wrote:
>
> but how can i get that error ? .. i tried (as you can see):
> if item.save
>  return true .... etc ..
>
> but that doesn't work :( ( obviously) ...
> i googled, read the cheatsheet, readme etc etc.
> irc doesn't respond so .. hopefully you guys know!!...
>
> thanxs :D

You'll probably get better responses from the sequel list:

http://groups.google.com/group/sequel-talk

However, I'm not exactly sure why you define a create method when it is
already
provided for you through Sequel::Model.

w = Website.new(:domain => 'somedomain.com')

This will generate an exception if somedomain.com already exists. If you
just
want that model, whether it has been created previously or not,

w = Website.find_or_create(:name => 'somedomain.com')

The methods relating to this you are probably looking for are here:

http://sequel.rubyforge.org/rdoc/classes/Sequel/Mo...

Hope that helps.
This topic is locked and can not be replied to.