RailsConf Panel: Metaprogramming Writertopia with Bill Katz

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.

!http://static.flickr.com/68/173879904_4576e078a1_m.jpg!:http://flickr.com/photos/kastner/173879904/

“http://www.writertopia.com/”:http://www.writertopia.com/
“http://www.writertopia.com/developers”:http://www.writertopia.com/developers
“http://www.simbiome.org/”:http://www.writertopia.com/developers
“http://simtk.org/svn/simbiome/”:http://simtk.org/svn/simbiome/

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


def secret_info
permit "(matz or dhh) and interested in Answers" do
render :text => "Then Answer of Life = 42"
end
end

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

init.rb:

ActiveRecord::Base.send(:include,
Authroizeation:ObjectRolesTable::UserExtensions,
Authorization::ObjectRolesTable::ModelExteions
)

Then for authorizable, it’s kind of the same thing.

2 thoughts on “RailsConf Panel: Metaprogramming Writertopia with Bill Katz”

  1. Thanks for the Comment Bill! You had a lot to get through in that panel, but it was all very very interesting. I like the concept of molding Rails, and by extension Ruby to do your bidding with a DSL, instead of just doing what is “normal”. I think that was one of the biggest mental lessons for me this weekend – Rails (and Ruby) is not set in stone, I can make it work for me! Thanks for helping me get there mentally.

Comments are closed.