Web 2.0 Mapping and Social Networks Group
1. Using Rails to build map611.com.
2. Using Rhosync and Rhodes to build map611 App.
Presenter: Dan
bikle@bikle.com
http://bikle.com
April 21, 2009
So, Using Rails to build map611.com.
Install Rhosync
1. http://wiki.rhomobile.com//index.php?title=Mobilizing_Your_Application_with_Rhomobile#Install_the_RhoSync_Server
Key step: Create "app" inside of Rhosync
2. Create map611.com in the Rhosync-Rails-Root
map611.com
login
Your Maps
Create New
Dans Pizza Parlor
Google Maps API
API Code(in "Model")
API Code(in "View")
Controller-View Enhancer: "Active Scaffold"
Create anchor-element from plain text
Add More maps
Update maps
Using Rhosync and Rhodes to build map611 App.
Rhosync and Rhodes Architecture
Rhosync Object Model
class Mmap < ActiveRecord::Base
belongs_to :user
class User < ActiveRecord::Base
has_many :mmaps
has_many :apps, :through=>:memberships
has_many :memberships
class App < ActiveRecord::Base
has_many :users, :through=>:memberships
has_many :memberships
has_many :sources
class Membership < ActiveRecord::Base
belongs_to :app
belongs_to :user
class Source < ActiveRecord::Base
belongs_to :app
attr_accessor :source_adapter,:current_user
Plain English:
- I need to create an app:
- I'll name it: "map611"
- I do it once by hand
- I need a source:
- I'll name it "M6"
- M6 will belong to map611 app
- I do it once by hand
- M6 needs to know about its source_adapter
- I do it once by hand
- Every user needs a membership to the app:
- I force this at run-time during each user creation
1. http://wiki.rhomobile.com//index.php?title=Mobilizing_Your_Application_with_Rhomobile#Install_the_RhoSync_Server
Key step: Create "app" inside of Rhosync
Key step: Create both source and source adapter inside of Rhosync(2 steps)
Code to force user membership to map611 app
Rhosync Source Adapter
Rhosync Source Adapter Code
Rhodes Code
Two shell commands:
1. rhogen app map611; cd map611
2. rhogen model mmap "http://localhost:6611/apps/map611/sources/m6" 22 label,address,phone1,phone2,email,uurl,notes,imgelem
Run Rhodes Code
iPhone Simulator
Web 2.0 Mapping and Social Networks Group
1. Using Rails to build map611.com.
2. Using Rhosync and Rhodes to build map611 App.
Presenter: Dan
bikle@bikle.com
http://bikle.com
April 21, 2009