On May 9, 3:57 am, "ARAI Shunichi" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I've started using Sequel in my new project, and I have 3 small requests.
>
> 1. Sequel.connect should take block
>
> I want to write like:
>
> Sequel.connect('postgres://test:[EMAIL PROTECTED]/egalite') { |db|
>   ....
>
> }
>
> not like:
>
> begin
>   db = Sequel.connect('postgres://test:[EMAIL PROTECTED]/egalite')
> ensure
>   db.disconnect
> end

I like this idea, it will be implemented before 2.0.

> 2. in a model method 'self' doesn't properly work
>
> class User < Sequel::Model
>   def User.digest(password)
>     Digest::MD5.hexdigest(password)
>   end
>   def password=(password)
>     self.hashed_password = self.digest(password) # <- latter 'self' doesn't
> work
>   end
> end
>
> I had to change latter 'self' to 'User'.

I'd do it this way:

class User < Sequel::Model
  def digest(password)
    Digest::MD5.hexdigest(password)
  end
  def password=(password)
    self.hashed_password = digest(password)
  end
end

> 3. Model.set_dataset(:tablename) doesn't work properly
>
> I tried
> Somemodel.set_dataset(:tablename)
> as it is written as in the document page, but it doesn't work.
>
> http://code.google.com/p/ruby-sequel/wiki/SequelModels
>
> I had to write like:
> Somemodel.set_dataset(db[:tablename])

Hmm, this was broken.  I've committed a fix for it in my private
repository, it'll be pushed to github later today.  Thanks for letting
me know.

Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to sequel-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to