Building a CRM System on Rails
Peter Marklund
Agenda
- Background and Overview
- Functionality and Architecture
- Selected Hacks
- More Hacks
- Testing
- Infrastructure and Deployment
- Discussion/Questions
Background and Overview
- Green Media Toolshed -
helping
environmental organizations reach the media
- Member Sites - publishing tool on Drupal (PHP/MySQL)
- Volunteer Hub - collaborative updating of contact info on Rails (PostgreSQL)
- Media Contact Manager (MCM) -
CRM on Rails (PostgreSQL)
Functionality and Design
- Advanced search for contacts and outlets
- Creating lists of contacts and outlets
- Sending email and fax to those lists
- Web 2.0 design by ScratchMedia
Database Schema
- outlets - New York Times, has many locations
- locations - Manhattan Office, has many jobs
- jobs - Editor, belongs to contact
- contacts - Jim Smith, has many jobs
- lists, many-to-many relationship with jobs and outlets
- bulk_emails (draft, scheduled, sent, send_error)
- emails (sent, address_missing, send_error, bounced,duplicate)
- faxes (request_sent, request_error, request_invalid, address_missing, sent, send_failure, duplicate)
Stats
- 7000 LOC
- 37 controllers, 60 models, 189 views and partials
- 90 migrations
- 800 revisions in Subversion since january
Selected Hacks
- Live search
- HTML tables with hidable columns (user preference)
- Scheduled jobs
- File storage
- TinyMCE WYSIWYG
- Dynarch calendar
More Hacks
- Faxing with MyFax.com web service API
- Timezones
- Go Back links
- Items per page (user preference)
- Talking to multiple databases
- Help Texts
- FasterCSV
Testing
- 7000 LOC, Code to test ratio 1:0.9, about 10,000 assertions in 400 tests
- HTML validation with Tidy and W3C
- HTML quoting - h(my_var) and link_to h(my_var)
- WWW::Mechanize for monitoring production server?
- Checking for broken links, submitting forms?
- Comprehensive suite of unit, controller, and integration tests
- Test coverage?
Infrastructure and Deployment
- Rails 1.1.6 / LightTPD / FastCGI / PostgreSQL
- Subversion, Trac, and Mantis
- Frequent server updates using Capistrano and rake deploy
- Staging and production servers
- Red Hat Enterprise at Rackspace
- Error notifications
- filter_parameter_logging("password") if RAILS_ENV == 'production'
- Monitoring? Response times?
Discussion/Questions
- Rails makes life easier - but not easy enough?
- Deployment is still hard
-
Reuse in the large (Zope, Drupal) vs
in the small
(Rails). Middle ground? Implications for SOA?
Thanks
- Thanks to Jarkko Laine, Paul Doerwald, and
the GMT
team for all the great work
-
Thanks to Johan Lind and
Valtech for hosting this meetup