Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
24 lines (16 sloc) 615 Bytes
* Observer pattern:
class MyObserver < Sequel::Observer
observe Item, Post
def after_save
* Smarter one_to_one: stuff like:
# assuming the Author's primary key is :name
post = Post.create(:name => 'The Lover', :author => Author['A.B. Yehoshua'])
post.set(:author => Author['A.B. Yehoshua'])
Book.filter_by_author(Author[:name => 'Kurt Vonnegut']).print
#and also
post = Post.create(:name => 'The Lover', :author => 'A.B. Yehoshua') #=> fetches the author record
post.set(:author => 'A.B. Yehoshua')
* many_to_many smart relationships.
Jump to Line
Something went wrong with that request. Please try again.