Protecting code and licensing for independently deployed Rails applications...?

Hi All,

I'm writing a Rails application which will have reasonably regular
updates -- nothing abnormal here. I face a problem, however, due to
the distribution model. Basically the application will be sold for
stand-alone "intranet" installation due to its "add-on" nature (it's
basically a web interface for an existing, database-driven industry
standard application).

My concern(s) then revolve(s) around protecting code and update models
(registration codes, etc.) for multiple independently deployed Rails
applications. Does anyone have a good starting point for reading up
on this? Any input regarding such a process?