KEMBAR78
Simple Social Networking with Ruby on Rails | PPT
Simple Social Networking With Ruby on Rails Justin Henry [email_address] http://greengaloshes.cc
Look, Ma! I’m on the Internets! delicious/kapowee  vimeo.com/bootstraps flickr.com/zappowbang twitter.com/jhenry upcoming.org/jhenry goodreads.com yelp.com linkedin.com brightkite.com friendfeed.com/puddlestomping
Simple Social Networking With Rails What is a social network?  Why build a social network?  How might one build a social network? Hey, look, an example!
What is a social network? Context of web applications Wikipedia has more on the broader, sociological concepts:  http://en.wikipedia.org/wiki/Social_network
What is a social network? Provides a Utility/Function (Content)  Content is still king  Content tends to be user-generated, controlled, and owned * Content interaction patterns (generating new content, sharing/republishing, modifying/remixing)
What is a social network? http://www.flickr.com/photos/vj_pdx/144902289/
What is a social network? It's People!  user relationships are many-to-many  a blog is one-to-many  User interaction patterns (friendships, fans, friends-of-friends)
Why build a social network? What are you selling? Idea, product, theology, movement, etc. Why will your users come here?
Why build a social network? What channels do you currently reach with your customers? How are you interacting with your customers? How do your customers interact with each other? How do your customers interact with their customers and others around them?
Why build a social network? The evolution of the newsletter newsletters -> email lists -> blogs -> social networks?
Why build a social network? It's fun! Crowdsourcing  Think small - it doesn't have to be the next Facebook. Put The Service and The Community back in community service Scratch that itch
How do you build a social network? Join as many as you can! Get a feel for what others are doing Consider this an education in UX/UI Reading blogs or books will help you become a better writer, so... Using these applications will inform your development process
How do you build a social network? What will our data look like? Users Relationships (friends/fans) Content
Pre-Fab vs. Home Cookin' Building from Scratch It's not too far off from the build-a-blog in 5 minutes example  Just need a few more models, right? Add in a few plugins....
Home Cookin' - Example Relationship Text create_table  :connections   do  | t |   t.integer  :person_id   t.integer  :contact_id   t.integer  :status   t.timestamp  :accepted_at   t.timestamps   end Insoshi's connections migrations:
Home Cookin' - Example Relationship create_table  :friendships   do  | t |   t.integer  "user_id" ,  :null  =>  false   t.integer  "friend_id" ,  :null  =>  false   t.datetime  "created_at"     t.datetime  "updated_at"     t.timestamps end Daniel Fischer’s “Fischy friends” example:
Home Cookin' A few plugins and tools for consideration: Paperclip acts_as_commentable acts_as_taggable_on
Pre-Fabricated Refactoring other people's code is a great way to learn Leaves you with the time to focus on implementing features, etc
Pre-Fabricated Community Engine "plugin" Insoshi platform Ning (furniture included!) Bort, etc (just the walls, please)
Enter Insoshi Advantage: a lot of pieces are pre-biult galleries, forums, blogs, messaging, activity feeds, events Disadvantage: a lot of pieces are pre-built may be lots to change or retrofit
Inshtalling Insoshi To sphinx or not to sphinx? installing sphinx on OSX is a pain - need to add symlink, i.e.: $ sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql To install without sphinx, just skip that part of the install process.
Building on top of Insoshi Yaay, I've got tests, yaaay! Users and relationships already exist Choose a model(s) to repurpose as needed (i.e. for custom content) Build new model(s) for custom content and interactions
Example App - MyEventCarbon App for attendees/promoters of local events: See the carbon footprint of their events  Organize carpools Suggest bus routes and other alternatives
Example App - MyEventCarbon Repurpose Insoshi's nascent event model Use Gmaps api for geocoding AMEE for carbon calculations (amee.com)
Example App - MyEventCarbon Plugins ym4r for embedding google maps rspec_response_enhancer - add more descriptive output to rspec Floppy-amee - for interacting with AMEE data
Example App - MyEventCarbon
Example App - MyEventCarbon
Example App - MyEventCarbon
Example App - MyEventCarbon
Example App - MyEventCarbon create_table  "event_attendees" ,  :force  =>  true   do  | t |   t.integer  "person_id"   t.integer  "event_id"   t.string  "origin"   t.string  "distance"   t.string  "carbon"   end schema.rb
Example App - MyEventCarbon belongs_to  :person   has_many  :event_attendees   has_many  :attendees ,  :through  =>  :event_attendees ,  :source  =>  :person ,  :select  =>  "event_attendees.origin, event_attendees.distance, event_attendees.carbon, people.*" app/models/event.rb
Example App - MyEventCarbon Carpooling? How to build a carpooling feature in? What would schema look like?
Example App - MyEventCarbon create_table  "communications" ,  :force  =>  true   do  | t |   t.string  "subject"   t.text  "content"   t.integer  "parent_id"   t.integer  "sender_id"   t.integer  "recipient_id"   t.datetime  "sender_deleted_at"   t.datetime  "sender_read_at"   t.datetime  "recipient_deleted_at"   t.datetime  "recipient_read_at"   t.datetime  "replied_at"   t.string  "type"   t.datetime  "created_at"   t.datetime  "updated_at"   t.integer  "conversation_id"   end You could modify an existing model: ... but that could impact other parts of the system.
Example App - MyEventCarbon class   CreateCarpools   < ActiveRecord::Migration   def   self.up   create_table  :carpools   do  | t |   t.integer  :person_id   t.integer  :contact_id   t.integer  :event_id   t.integer  :status   t.timestamp  :accepted_at   t.timestamps   end A new table might be more appropriate: Duplicate the connections table, add an event_id and whatever other fields as needed.
Example App - MyEventCarbon Next steps  Carpooling offering/accepting/tracking “Live” carbon calculations Pull events from other services (upcoming, eventful) Import ical files, RSS, microformats (hcal) Adding to activity feed backchannel integration
Moving forward Your homework:  Join some more social networks and start using them. They work best when people you know (that's us) are using them with you Join me! Some of my networks are listed at  http://friendfeed.com/puddlestomping
Sourced/Resourced Wikipedia article on &quot;Social Network&quot;  http://en.wikipedia.org/wiki/Social_network Jim Neath > Building a Social Network Site in Rails:  http://jimneath.org/2008/04/25/building-a-social-network-site-in-rails/ MissingMethod > How To Build a Social Network with Ruby on Rails:  http://www.missingmethod.com/2007/01/08/how-to-build-a-social-network-with-ruby-on-rails/ Friendship model examples & self referential models:  Dan Fischer > Fischyfriends:  http://github.com/dfischer/fischyfriends/tree/master Josh Susser > Self-referential has_many :through associations:  http://blog.hasmanythrough.com/2007/10/30/self-referential-has-many-through Installing sphinx on OSX: http://www.sparkboxx.com/sparkboxx/2008/10/installing-ultr.html
Thanks [email_address] http://greengalosh es.cc

Simple Social Networking with Ruby on Rails

  • 1.
    Simple Social NetworkingWith Ruby on Rails Justin Henry [email_address] http://greengaloshes.cc
  • 2.
    Look, Ma! I’mon the Internets! delicious/kapowee vimeo.com/bootstraps flickr.com/zappowbang twitter.com/jhenry upcoming.org/jhenry goodreads.com yelp.com linkedin.com brightkite.com friendfeed.com/puddlestomping
  • 3.
    Simple Social NetworkingWith Rails What is a social network? Why build a social network? How might one build a social network? Hey, look, an example!
  • 4.
    What is asocial network? Context of web applications Wikipedia has more on the broader, sociological concepts: http://en.wikipedia.org/wiki/Social_network
  • 5.
    What is asocial network? Provides a Utility/Function (Content) Content is still king Content tends to be user-generated, controlled, and owned * Content interaction patterns (generating new content, sharing/republishing, modifying/remixing)
  • 6.
    What is asocial network? http://www.flickr.com/photos/vj_pdx/144902289/
  • 7.
    What is asocial network? It's People! user relationships are many-to-many a blog is one-to-many User interaction patterns (friendships, fans, friends-of-friends)
  • 8.
    Why build asocial network? What are you selling? Idea, product, theology, movement, etc. Why will your users come here?
  • 9.
    Why build asocial network? What channels do you currently reach with your customers? How are you interacting with your customers? How do your customers interact with each other? How do your customers interact with their customers and others around them?
  • 10.
    Why build asocial network? The evolution of the newsletter newsletters -> email lists -> blogs -> social networks?
  • 11.
    Why build asocial network? It's fun! Crowdsourcing Think small - it doesn't have to be the next Facebook. Put The Service and The Community back in community service Scratch that itch
  • 12.
    How do youbuild a social network? Join as many as you can! Get a feel for what others are doing Consider this an education in UX/UI Reading blogs or books will help you become a better writer, so... Using these applications will inform your development process
  • 13.
    How do youbuild a social network? What will our data look like? Users Relationships (friends/fans) Content
  • 14.
    Pre-Fab vs. HomeCookin' Building from Scratch It's not too far off from the build-a-blog in 5 minutes example Just need a few more models, right? Add in a few plugins....
  • 15.
    Home Cookin' -Example Relationship Text create_table :connections do | t | t.integer :person_id t.integer :contact_id t.integer :status t.timestamp :accepted_at t.timestamps end Insoshi's connections migrations:
  • 16.
    Home Cookin' -Example Relationship create_table :friendships do | t | t.integer &quot;user_id&quot; , :null => false t.integer &quot;friend_id&quot; , :null => false t.datetime &quot;created_at&quot; t.datetime &quot;updated_at&quot; t.timestamps end Daniel Fischer’s “Fischy friends” example:
  • 17.
    Home Cookin' Afew plugins and tools for consideration: Paperclip acts_as_commentable acts_as_taggable_on
  • 18.
    Pre-Fabricated Refactoring otherpeople's code is a great way to learn Leaves you with the time to focus on implementing features, etc
  • 19.
    Pre-Fabricated Community Engine&quot;plugin&quot; Insoshi platform Ning (furniture included!) Bort, etc (just the walls, please)
  • 20.
    Enter Insoshi Advantage:a lot of pieces are pre-biult galleries, forums, blogs, messaging, activity feeds, events Disadvantage: a lot of pieces are pre-built may be lots to change or retrofit
  • 21.
    Inshtalling Insoshi Tosphinx or not to sphinx? installing sphinx on OSX is a pain - need to add symlink, i.e.: $ sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql To install without sphinx, just skip that part of the install process.
  • 22.
    Building on topof Insoshi Yaay, I've got tests, yaaay! Users and relationships already exist Choose a model(s) to repurpose as needed (i.e. for custom content) Build new model(s) for custom content and interactions
  • 23.
    Example App -MyEventCarbon App for attendees/promoters of local events: See the carbon footprint of their events Organize carpools Suggest bus routes and other alternatives
  • 24.
    Example App -MyEventCarbon Repurpose Insoshi's nascent event model Use Gmaps api for geocoding AMEE for carbon calculations (amee.com)
  • 25.
    Example App -MyEventCarbon Plugins ym4r for embedding google maps rspec_response_enhancer - add more descriptive output to rspec Floppy-amee - for interacting with AMEE data
  • 26.
    Example App -MyEventCarbon
  • 27.
    Example App -MyEventCarbon
  • 28.
    Example App -MyEventCarbon
  • 29.
    Example App -MyEventCarbon
  • 30.
    Example App -MyEventCarbon create_table &quot;event_attendees&quot; , :force => true do | t | t.integer &quot;person_id&quot; t.integer &quot;event_id&quot; t.string &quot;origin&quot; t.string &quot;distance&quot; t.string &quot;carbon&quot; end schema.rb
  • 31.
    Example App -MyEventCarbon belongs_to :person has_many :event_attendees has_many :attendees , :through => :event_attendees , :source => :person , :select => &quot;event_attendees.origin, event_attendees.distance, event_attendees.carbon, people.*&quot; app/models/event.rb
  • 32.
    Example App -MyEventCarbon Carpooling? How to build a carpooling feature in? What would schema look like?
  • 33.
    Example App -MyEventCarbon create_table &quot;communications&quot; , :force => true do | t | t.string &quot;subject&quot; t.text &quot;content&quot; t.integer &quot;parent_id&quot; t.integer &quot;sender_id&quot; t.integer &quot;recipient_id&quot; t.datetime &quot;sender_deleted_at&quot; t.datetime &quot;sender_read_at&quot; t.datetime &quot;recipient_deleted_at&quot; t.datetime &quot;recipient_read_at&quot; t.datetime &quot;replied_at&quot; t.string &quot;type&quot; t.datetime &quot;created_at&quot; t.datetime &quot;updated_at&quot; t.integer &quot;conversation_id&quot; end You could modify an existing model: ... but that could impact other parts of the system.
  • 34.
    Example App -MyEventCarbon class CreateCarpools < ActiveRecord::Migration def self.up create_table :carpools do | t | t.integer :person_id t.integer :contact_id t.integer :event_id t.integer :status t.timestamp :accepted_at t.timestamps end A new table might be more appropriate: Duplicate the connections table, add an event_id and whatever other fields as needed.
  • 35.
    Example App -MyEventCarbon Next steps Carpooling offering/accepting/tracking “Live” carbon calculations Pull events from other services (upcoming, eventful) Import ical files, RSS, microformats (hcal) Adding to activity feed backchannel integration
  • 36.
    Moving forward Yourhomework: Join some more social networks and start using them. They work best when people you know (that's us) are using them with you Join me! Some of my networks are listed at http://friendfeed.com/puddlestomping
  • 37.
    Sourced/Resourced Wikipedia articleon &quot;Social Network&quot; http://en.wikipedia.org/wiki/Social_network Jim Neath > Building a Social Network Site in Rails: http://jimneath.org/2008/04/25/building-a-social-network-site-in-rails/ MissingMethod > How To Build a Social Network with Ruby on Rails: http://www.missingmethod.com/2007/01/08/how-to-build-a-social-network-with-ruby-on-rails/ Friendship model examples & self referential models: Dan Fischer > Fischyfriends: http://github.com/dfischer/fischyfriends/tree/master Josh Susser > Self-referential has_many :through associations: http://blog.hasmanythrough.com/2007/10/30/self-referential-has-many-through Installing sphinx on OSX: http://www.sparkboxx.com/sparkboxx/2008/10/installing-ultr.html
  • 38.

Editor's Notes

  • #2 * application manager (bb, univ. vermont) * developer (php, etc, rails in the past year)