You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 18, 2018. It is now read-only.
I'm just getting started with Curator, which I'm really excited about, but one interesting feature which I think would make it even more compelling is to add callbacks or hooks, similar to what ActiveRecord has done.
In my case, I've got a Post model with a title and slug, and I'm trying to default the slug if one was not explicitly passed, but respect an explicit one if it is passed in. My code looks something like this:
class Post
include Curator::Model
attr_accessor :title, :slug
def initialize(args={})
args[:slug] ||= args[:title].to_slug
super(args)
end
end
I'd love to be able to hook into an after_create callback which would mean I don't need to override initialize while still calling super after I've made cahnges to args.
Does this seem like something valuable for Curator?