Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

EPE

DESARROLLO PARA ENTORNO WEB

Unidad 3 | Capa de Lgica de Negocio

CALLBACKS EN RUBY ON RAILS

LOGRO
Al finalizar la unidad el alumno
desarrolla la capa de negocio de una
aplicacin Web.

AGENDA
CALLBACKS

CALLBACKS
Mtodos invocados en determinados momentos
del ciclo de vida de un objeto.

CALLBACKS
before_validation
around_save
after_create
after_rollback
before_save
around_update
after_commit
around_destroy
after_rollback

after_validationbefore_save
before_create
around_create
after_save
after_commit
before_validation after_validation
around_save
before_update
after_update
after_save
after_rollback
before_destroy
after_destroy
after_commit

CALLBACKS
class Blog < ActiveRecord::Base
has_many :posts, dependent: :destroy
before_destroy :log_blog_destroy
private
def log_blog_destroy
puts "About to destroy blog #{self.name}"
end
end

AGENDA
CALLBACKS

REFERENCIAS
https://www.railstutorial.org
http://www.martinfowler.com/eaaCatalog/index.html
http://guides.rubyonrails.org

You might also like