aka. “Some things I learned when trying to build my program up toward a DRY domain-specific language”
Short version: Very very dense talk, but great stuff. I think I’ll grok it at a later date.
h3. Bottom-up Design
“It’s OK to look like a fool.” – Paul Graham from yesterday. That was on a slide – AGILE!
h3. “What I wanted”
His goal was to have a DSL inside of rails that allowed him to do thigs like
@current_user.has_role? “moderator”@, etc.
h3. Our Tour
* Authorization DSL
* Objects classes and singletons
* Authorization Plugin
* Identity Plugin
permit "(matz or dhh) and interested in Answers" do
render :text => "Then Answer of Life = 42"
h4. How do we “permit”
insert class method “permit”. Needs to filter all instance methods, before_filter is similiar (so it’s a clue)
insert instance method “permit”
In the init.rb – send include into actioncontrolelr::base_send and actionview::base.send
(I need to get these slides, they are DENSE. They will be online.)
h4. How do we do this?
Insert class method which insert required methods
Then for authorizable, it’s kind of the same thing.