Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ipoval/sequel_observer

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sequel::Observer

"Sequel::Observer" provides an easy (ActiveRecord-like) way to create the Observers for callbacks in the models of Sequel ORM.

Creating Observers

For example, imagine a User model where we want to send an email every time a new user is created.

Since sending emails is not directly related to our model's purpose, we could create an observer to delegate that functionality.

  class UserObserver < Sequel::Observer
    def after_create(model_instance_record)
      # code to send confirmation email...
    end
  end

The observer's methods receive the instance of the model that caused the callback to fire as a parameter.

Installing the Gem

RubyGems is the preferred easy to install method for "Sequel::Observer".

$ sudo gem install sequel_observer

?s

email: ipoval@ya.ru

twitter: @ipoval

About

The Observer for callbacks in models of Sequel ORM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.