On Tuesday, March 22, 2016 at 4:39:55 AM UTC-7, Alexander Popov wrote:
>
> @db.fetch = {:id=>1, :name=>'Al'}
>

Here you set @db to yield {:id=>1, :name=>'Al'}for all queries that return 
rows.
 

>
> # ...
> @Album.where({:name=>"Al2"}) # => #<Sequel::Mock::Dataset: "SELECT * FROM 
> albums WHERE (name = 'Al2')">
> @Album.where({:name=>"Al2"}).all # => [#< @values={:id=>1, :name=>"Al"}>]
> @Album.where({:name=>"Al2"}).first # => #< @values={:id=>1, :name=>"Al"}>
>
> Why?
>

The rows returned by a mocked database are purely what you tell it to 
return, they are not based on the dataset SQL, unless you are using the SQL 
to decide what to return by passing a proc to @db.fetch.

Thanks,
Jeremy
 

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to