SlideShare a Scribd company logo
Flex and Rails   Tony Hillerson
                  Software Architect

with RubyAMF      EffectiveUI
                  RailsConf
Code and Slides:
http://github.com/thillerson/preso_code/
Sample du Jour: Stuff
Why Flex and Rails?

They Make The
Great Tag Team!
[SKIP INTRO]
What are the Options?
XML
XML is the Default
     Option
# POST /contexts
# POST /contexts.xml
def create
  @context = Context.new(params[:context])
  respond_to do |format|
    if @context.save
      flash[:notice] = 'Context was successfully created.'
      format.html { redirect_to(@context) }
      format.xml {
         render :xml => @context,
         :status => :created, :location => @context }
    else
      format.html { render :action => quot;newquot; }
      format.xml {
         render :xml => @context.errors,
         :status => :unprocessable_entity }
    end
  end
end
JSON

Javascript Object Notation
JSON is in Rails Too
format.json { render :json => @context.to_json }


        http://as3corlib.googlecode.com


   var obj:Object = JSON.decode(jsonString)
AMF

Action Message Format
AMF is the Good Stuff

Buck Thinks it’s Great!
RubyAMF


       http://rubyamf.org
http://rubyamf.googlecode.com
Installing RubyAMF
$ script/plugin install http://rubyamf.googlecode.com/svn/current/rubyamf


  • New File: app/controllers/rubyamf_controller.rb
  • New File: config/rubyamf_config.rb
  • config/initializers/mime_types.rb modified:
     Mime::Type.register quot;application/x-amfquot;, :amf

  • config/routes.rb modified:
    ActionController::Routing::Routes.draw do |map|
        map.rubyamf_gateway 'rubyamf_gateway',
          :controller => 'rubyamf', :action => 'gateway'
    end
Con guring RubyAMF
module RubyAMF
  module Configuration
    ClassMappings.translate_case = true
    ClassMappings.assume_types = false
    ParameterMappings.scaffolding = true
    ClassMappings.register(
      :actionscript => 'Task',
      :ruby          => 'Task',
      :type          => 'active_record',
      #:associations => [quot;contextquot;],
      :attributes    => [quot;idquot;, quot;labelquot;, quot;context_idquot;,
         quot;completed_atquot;, quot;created_atquot;, quot;updated_atquot;])
  end
end
Con guring RubyAMF
ClassMappings.translate_case = false

public var created_at:Date;


ClassMappings.translate_case = true

public var createdAt:Date; // created_at in rails
Con guring RubyAMF
  ClassMappings.assume_types = true

  class Context < ActiveRecord::Base
              matches
   [RemoteClass(alias=quot;Contextquot;)]
   public class Context {

               for free
Con guring RubyAMF
  ClassMappings.assume_types = false

  class Context < ActiveRecord::Base
              matches
   [RemoteClass(alias=quot;Contextquot;)]
   public class Context {

          with registration
  ClassMappings.register(
    :actionscript => 'Context',
    :ruby          => 'Context',
    :type          => 'active_record',
    :attributes    => [quot;idquot;, ...])
Con guring RubyAMF
              ParameterMappings.scaffolding = false

                                       def save
                         becomes
     save(context);                      @context = params[0]


             ParameterMappings.scaffolding = true
                                       def save
save(
                                         @context =
                         becomes
   {context:context}
                                            params[:context]
);
Connecting to Rails via
       RubyAMF
<mx:RemoteObject
    	id=quot;contextsServicequot;
    	destination=quot;rubyamfquot;
    	endpoint=quot;http://localhost:3000/rubyamf_gateway/quot;
    	source=quot;ContextsControllerquot;
    	showBusyCursor=quot;truequot;
/>
public function save(context:Context):void {
	 	 var call:AsyncToken =
          contextsService.save({context:context});
	 	 call.addResponder(responder);
}
Development Work ow
1. Generate and Migrate
$ script/generate rubyamf_scaffold context label:string
class CreateContexts < ActiveRecord::Migration
  def self.up
    create_table :contexts do |t|
      t.string :label
      t.timestamps
    end
  end

  def self.down
    drop_table :contexts
  end
end
$ rake db:migrate
def load_all
  @contexts = Context.find :all

  respond_to do |format|
    format.amf { render :amf => @contexts }
  end
end

def save
  respond_to do |format|
    format.amf do
      if params[:context].save
         render :amf => params[:context]
      else
         render :amf =>
           FaultObject.new(params[:context].errors.join(quot;nquot;))
      end
    end
  end
end
2. Sample Data
work:
  id: 1
  label: Work

home:
  id: 2
  label: Home

anarco_syndicalist_commune_biweekly_meetings:
  id: 3
  label: Anarcho-syndicalist Commune Bi-weekly Meetings
3. Test
class Context < ActiveRecord::Base
  validates_presence_of :label



class ContextTest < ActiveSupport::TestCase
  def test_context_without_label_fails
    non_label_context = Context.new
    assert !(non_label_context.save)
    error_messages = non_label_context.errors.on(:label)
    assert !(error_messages.empty?)
  end
4. Con gure

ClassMappings.register(
  :actionscript => 'Context',
  :ruby          => 'Context',
  :type          => 'active_record',
  #:associations => [quot;tasksquot;],
  :attributes    => [quot;idquot;, quot;labelquot;, quot;created_atquot;, quot;updated_atquot;])
5. Wire
<mx:RemoteObject
    	id=quot;contextsServicequot;
    	destination=quot;rubyamfquot;
    	endpoint=quot;http://localhost:3000/rubyamf_gateway/quot;
    	source=quot;ContextsControllerquot;
    	showBusyCursor=quot;truequot;
/>

<mx:RemoteObject
     id=quot;tasksServicequot;
     destination=quot;rubyamfquot;
    	endpoint=quot;http://localhost:3000/rubyamf_gateway/quot;
    	source=quot;TasksControllerquot;
    	showBusyCursor=quot;truequot;
/>
5. Wire
public function loadAll():void {
	 var call:AsyncToken = service.load_all();
	 call.addResponder(responder);
}

public function save(context:Context):void {
	 var call:AsyncToken =
       service.save({context:context});
	 call.addResponder(responder);
}

public function destroy(context:Context):void {
	 var call:AsyncToken =
       service.destroy({id:context.id});
	 call.addResponder(responder);
}
5. Wire
public function execute(event:CairngormEvent):void {
	 var evt:SaveContextEvent = event as SaveContextEvent;
	 var delegate:ContextsDelegate = new ContextsDelegate(this);
	 delegate.save(evt.context);
}

public function result(data:Object):void {
	 var result:ResultEvent = data as ResultEvent;
	 var context:Context = result.result as Context;
  ...
}
X. Rinse and Repeat
The Future
Gem
Plugin + Gem
 C Extension
Gem
   Plugin
C Extension
An Impassioned Plea
Resources:

http://rubyamf.googlecode.com
http://groups.google.com/group/rubyamf
http://github.com/thillerson/rubyamf
Your
                              Bob
                                        Father




                                         You




     Thanks!
     Tony Hillerson
     http://slideshare.com/thillerson
     http://github.com/thillerson
     http://thillerson.blogspot.com
     http://effectiveui.com

     Twitter: thillerson
     Brightkite: thillerson




39

More Related Content

What's hot

Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClient
Adam Wiggins
 
Javascript asynchronous
Javascript asynchronousJavascript asynchronous
Javascript asynchronous
kang taehun
 
Tasks: you gotta know how to run them
Tasks: you gotta know how to run themTasks: you gotta know how to run them
Tasks: you gotta know how to run them
Filipe Ximenes
 
node ffi
node ffinode ffi
node ffi
偉格 高
 
Introduction to asynchronous DB access using Node.js and MongoDB
Introduction to asynchronous DB access using Node.js and MongoDBIntroduction to asynchronous DB access using Node.js and MongoDB
Introduction to asynchronous DB access using Node.js and MongoDB
Adrien Joly
 
[Quase] Tudo que você precisa saber sobre tarefas assíncronas
[Quase] Tudo que você precisa saber sobre  tarefas assíncronas[Quase] Tudo que você precisa saber sobre  tarefas assíncronas
[Quase] Tudo que você precisa saber sobre tarefas assíncronas
Filipe Ximenes
 
Slim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutSlim RedBeanPHP and Knockout
Slim RedBeanPHP and Knockout
Vic Metcalfe
 
Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...
Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...
Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...
Alberto Perdomo
 
Background Jobs - Com BackgrounDRb
Background Jobs - Com BackgrounDRbBackground Jobs - Com BackgrounDRb
Background Jobs - Com BackgrounDRbJuan Maiz
 
Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perl
deepfountainconsulting
 
エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo
エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyoエラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo
エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo
Shohei Okada
 
Perl: Coro asynchronous
Perl: Coro asynchronous Perl: Coro asynchronous
Perl: Coro asynchronous
Shmuel Fomberg
 
Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpmsom_nangia
 
Артем Яворский "Compile like it's 2017"
Артем Яворский "Compile like it's 2017"Артем Яворский "Compile like it's 2017"
Артем Яворский "Compile like it's 2017"
Fwdays
 
Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)
xSawyer
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworksdiego_k
 
Build Systems with autoconf, automake and libtool [updated]
Build Systems with autoconf, automake and libtool [updated]Build Systems with autoconf, automake and libtool [updated]
Build Systems with autoconf, automake and libtool [updated]
Benny Siegert
 
Any event intro
Any event introAny event intro
Any event intro
qiang
 
Keeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkKeeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkJeremy Kendall
 

What's hot (19)

Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClient
 
Javascript asynchronous
Javascript asynchronousJavascript asynchronous
Javascript asynchronous
 
Tasks: you gotta know how to run them
Tasks: you gotta know how to run themTasks: you gotta know how to run them
Tasks: you gotta know how to run them
 
node ffi
node ffinode ffi
node ffi
 
Introduction to asynchronous DB access using Node.js and MongoDB
Introduction to asynchronous DB access using Node.js and MongoDBIntroduction to asynchronous DB access using Node.js and MongoDB
Introduction to asynchronous DB access using Node.js and MongoDB
 
[Quase] Tudo que você precisa saber sobre tarefas assíncronas
[Quase] Tudo que você precisa saber sobre  tarefas assíncronas[Quase] Tudo que você precisa saber sobre  tarefas assíncronas
[Quase] Tudo que você precisa saber sobre tarefas assíncronas
 
Slim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutSlim RedBeanPHP and Knockout
Slim RedBeanPHP and Knockout
 
Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...
Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...
Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...
 
Background Jobs - Com BackgrounDRb
Background Jobs - Com BackgrounDRbBackground Jobs - Com BackgrounDRb
Background Jobs - Com BackgrounDRb
 
Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perl
 
エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo
エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyoエラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo
エラー時にログに出力する情報と画面に表示する情報を分ける #LaravelTokyo
 
Perl: Coro asynchronous
Perl: Coro asynchronous Perl: Coro asynchronous
Perl: Coro asynchronous
 
Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpm
 
Артем Яворский "Compile like it's 2017"
Артем Яворский "Compile like it's 2017"Артем Яворский "Compile like it's 2017"
Артем Яворский "Compile like it's 2017"
 
Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
Build Systems with autoconf, automake and libtool [updated]
Build Systems with autoconf, automake and libtool [updated]Build Systems with autoconf, automake and libtool [updated]
Build Systems with autoconf, automake and libtool [updated]
 
Any event intro
Any event introAny event intro
Any event intro
 
Keeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkKeeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro framework
 

Viewers also liked

Resurfacing
ResurfacingResurfacing
Resurfacing
LEFLOT Jean-Louis
 
The Information Advantage - Information Access in Tomorrow's Enterprise
The Information Advantage - Information Access in Tomorrow's EnterpriseThe Information Advantage - Information Access in Tomorrow's Enterprise
The Information Advantage - Information Access in Tomorrow's EnterpriseElizabeth Lupfer
 
Top 10 Clues That Your Presentation Is Too Long
Top 10 Clues That Your Presentation Is Too LongTop 10 Clues That Your Presentation Is Too Long
Top 10 Clues That Your Presentation Is Too Long
Susan Joy Schleef
 
Mercer: What's Working Research on Employee Engagement
Mercer: What's Working Research on Employee EngagementMercer: What's Working Research on Employee Engagement
Mercer: What's Working Research on Employee Engagement
Elizabeth Lupfer
 
Beyond Employee Engagement | @dalecarnegie
Beyond Employee Engagement | @dalecarnegieBeyond Employee Engagement | @dalecarnegie
Beyond Employee Engagement | @dalecarnegie
Elizabeth Lupfer
 
Focas bebês - Focas babies
Focas bebês - Focas babiesFocas bebês - Focas babies
Focas bebês - Focas babies
Assinoê Oliveira
 
The Power of Peace
The Power of PeaceThe Power of Peace
The Power of Peace
Assinoê Oliveira
 
How To Present
How To PresentHow To Present
How To Present
Geoff Stilwell
 
Relationships 2.0
Relationships 2.0Relationships 2.0
Relationships 2.0
MissSomething
 
Midwinter Holidays: Rebirth of Light
Midwinter Holidays:  Rebirth of LightMidwinter Holidays:  Rebirth of Light
Midwinter Holidays: Rebirth of Light
Susan Joy Schleef
 
MRV Folder Fortune / Fortaleza - CE
MRV Folder Fortune / Fortaleza - CEMRV Folder Fortune / Fortaleza - CE
MRV Folder Fortune / Fortaleza - CEMRV Engenharia
 
tamtan company profile
tamtan company profiletamtan company profile
tamtan company profilesandy sandy
 
Information Extraction and Linked Data Cloud
Information Extraction and Linked Data CloudInformation Extraction and Linked Data Cloud
Information Extraction and Linked Data Cloud
Dhaval Thakker
 
The Brand Train - Branding on the move
The Brand Train - Branding on the moveThe Brand Train - Branding on the move
The Brand Train - Branding on the move
Umesh R. Sonawane
 
ICEIM Conference, Durban, SA 2014 - Sudeep Krishnan, IIM Ahmedabad
ICEIM Conference, Durban, SA 2014 - Sudeep Krishnan, IIM AhmedabadICEIM Conference, Durban, SA 2014 - Sudeep Krishnan, IIM Ahmedabad
ICEIM Conference, Durban, SA 2014 - Sudeep Krishnan, IIM Ahmedabad
Sudeep Krishnan
 
Grafittis, Lenguaje Urbano
Grafittis, Lenguaje UrbanoGrafittis, Lenguaje Urbano
Grafittis, Lenguaje Urbano
nico552
 
Holiday Greetings
Holiday GreetingsHoliday Greetings
Holiday Greetings
Susan Joy Schleef
 

Viewers also liked (20)

Resurfacing
ResurfacingResurfacing
Resurfacing
 
The Information Advantage - Information Access in Tomorrow's Enterprise
The Information Advantage - Information Access in Tomorrow's EnterpriseThe Information Advantage - Information Access in Tomorrow's Enterprise
The Information Advantage - Information Access in Tomorrow's Enterprise
 
Top 10 Clues That Your Presentation Is Too Long
Top 10 Clues That Your Presentation Is Too LongTop 10 Clues That Your Presentation Is Too Long
Top 10 Clues That Your Presentation Is Too Long
 
Mercer: What's Working Research on Employee Engagement
Mercer: What's Working Research on Employee EngagementMercer: What's Working Research on Employee Engagement
Mercer: What's Working Research on Employee Engagement
 
Beyond Employee Engagement | @dalecarnegie
Beyond Employee Engagement | @dalecarnegieBeyond Employee Engagement | @dalecarnegie
Beyond Employee Engagement | @dalecarnegie
 
Focas bebês - Focas babies
Focas bebês - Focas babiesFocas bebês - Focas babies
Focas bebês - Focas babies
 
The Power of Peace
The Power of PeaceThe Power of Peace
The Power of Peace
 
How To Present
How To PresentHow To Present
How To Present
 
Global Warming
Global WarmingGlobal Warming
Global Warming
 
Relationships 2.0
Relationships 2.0Relationships 2.0
Relationships 2.0
 
Midwinter Holidays: Rebirth of Light
Midwinter Holidays:  Rebirth of LightMidwinter Holidays:  Rebirth of Light
Midwinter Holidays: Rebirth of Light
 
MRV Folder Fortune / Fortaleza - CE
MRV Folder Fortune / Fortaleza - CEMRV Folder Fortune / Fortaleza - CE
MRV Folder Fortune / Fortaleza - CE
 
Module05
Module05Module05
Module05
 
tamtan company profile
tamtan company profiletamtan company profile
tamtan company profile
 
Information Extraction and Linked Data Cloud
Information Extraction and Linked Data CloudInformation Extraction and Linked Data Cloud
Information Extraction and Linked Data Cloud
 
The Brand Train - Branding on the move
The Brand Train - Branding on the moveThe Brand Train - Branding on the move
The Brand Train - Branding on the move
 
ICEIM Conference, Durban, SA 2014 - Sudeep Krishnan, IIM Ahmedabad
ICEIM Conference, Durban, SA 2014 - Sudeep Krishnan, IIM AhmedabadICEIM Conference, Durban, SA 2014 - Sudeep Krishnan, IIM Ahmedabad
ICEIM Conference, Durban, SA 2014 - Sudeep Krishnan, IIM Ahmedabad
 
Module03
Module03Module03
Module03
 
Grafittis, Lenguaje Urbano
Grafittis, Lenguaje UrbanoGrafittis, Lenguaje Urbano
Grafittis, Lenguaje Urbano
 
Holiday Greetings
Holiday GreetingsHoliday Greetings
Holiday Greetings
 

Similar to Flex With Rubyamf

All I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web FrameworkAll I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web Framework
Ben Scofield
 
Adventurous Merb
Adventurous MerbAdventurous Merb
Adventurous Merb
Matt Todd
 
Rails 2.3 and Rack - NHRuby Feb 2009
Rails 2.3 and Rack - NHRuby Feb 2009Rails 2.3 and Rack - NHRuby Feb 2009
Rails 2.3 and Rack - NHRuby Feb 2009
bturnbull
 
Red5 - PHUG Workshops
Red5 - PHUG WorkshopsRed5 - PHUG Workshops
Red5 - PHUG Workshops
Brendan Sera-Shriar
 
Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2Hugo Hamon
 
And the Greatest of These Is ... Rack Support
And the Greatest of These Is ... Rack SupportAnd the Greatest of These Is ... Rack Support
And the Greatest of These Is ... Rack Support
Ben Scofield
 
Rush, a shell that will yield to you
Rush, a shell that will yield to youRush, a shell that will yield to you
Rush, a shell that will yield to you
guestdd9d06
 
Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007
Guillaume Laforge
 
Ruby on Rails - Introduction
Ruby on Rails - IntroductionRuby on Rails - Introduction
Ruby on Rails - Introduction
Vagmi Mudumbai
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBox
bobmcwhirter
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App Engine
Andy McKay
 
SproutCore and the Future of Web Apps
SproutCore and the Future of Web AppsSproutCore and the Future of Web Apps
SproutCore and the Future of Web Apps
Mike Subelsky
 
Building web framework with Rack
Building web framework with RackBuilding web framework with Rack
Building web framework with Rack
sickill
 
OSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialOSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialYi-Ting Cheng
 
浜松Rails3道場 其の四 View編
浜松Rails3道場 其の四 View編浜松Rails3道場 其の四 View編
浜松Rails3道場 其の四 View編Masakuni Kato
 
ES6: The Awesome Parts
ES6: The Awesome PartsES6: The Awesome Parts
ES6: The Awesome Parts
Domenic Denicola
 
Sprockets
SprocketsSprockets

Similar to Flex With Rubyamf (20)

All I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web FrameworkAll I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web Framework
 
Adventurous Merb
Adventurous MerbAdventurous Merb
Adventurous Merb
 
Rails 2.3 and Rack - NHRuby Feb 2009
Rails 2.3 and Rack - NHRuby Feb 2009Rails 2.3 and Rack - NHRuby Feb 2009
Rails 2.3 and Rack - NHRuby Feb 2009
 
Red5 - PHUG Workshops
Red5 - PHUG WorkshopsRed5 - PHUG Workshops
Red5 - PHUG Workshops
 
Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2
 
And the Greatest of These Is ... Rack Support
And the Greatest of These Is ... Rack SupportAnd the Greatest of These Is ... Rack Support
And the Greatest of These Is ... Rack Support
 
Rush, a shell that will yield to you
Rush, a shell that will yield to youRush, a shell that will yield to you
Rush, a shell that will yield to you
 
Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007Grails Introduction - IJTC 2007
Grails Introduction - IJTC 2007
 
Rails 4.0
Rails 4.0Rails 4.0
Rails 4.0
 
Ruby on Rails - Introduction
Ruby on Rails - IntroductionRuby on Rails - Introduction
Ruby on Rails - Introduction
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBox
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App Engine
 
Jicc teaching rails
Jicc teaching railsJicc teaching rails
Jicc teaching rails
 
SproutCore and the Future of Web Apps
SproutCore and the Future of Web AppsSproutCore and the Future of Web Apps
SproutCore and the Future of Web Apps
 
Building web framework with Rack
Building web framework with RackBuilding web framework with Rack
Building web framework with Rack
 
OSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialOSDC 2009 Rails Turtorial
OSDC 2009 Rails Turtorial
 
Rack Middleware
Rack MiddlewareRack Middleware
Rack Middleware
 
浜松Rails3道場 其の四 View編
浜松Rails3道場 其の四 View編浜松Rails3道場 其の四 View編
浜松Rails3道場 其の四 View編
 
ES6: The Awesome Parts
ES6: The Awesome PartsES6: The Awesome Parts
ES6: The Awesome Parts
 
Sprockets
SprocketsSprockets
Sprockets
 

More from Tony Hillerson

Totally Build Apps for Free! (not really)
Totally Build Apps for Free! (not really)Totally Build Apps for Free! (not really)
Totally Build Apps for Free! (not really)
Tony Hillerson
 
Working with Git
Working with GitWorking with Git
Working with Git
Tony Hillerson
 
Dynamic Sound for Android
Dynamic Sound for AndroidDynamic Sound for Android
Dynamic Sound for Android
Tony Hillerson
 
Git for Android Developers
Git for Android DevelopersGit for Android Developers
Git for Android Developers
Tony Hillerson
 
Designing an Android App from Idea to Market
Designing an Android App from Idea to MarketDesigning an Android App from Idea to Market
Designing an Android App from Idea to MarketTony Hillerson
 
Rails on HBase
Rails on HBaseRails on HBase
Rails on HBase
Tony Hillerson
 
SCM for Android Developers Using Git
SCM for Android Developers Using GitSCM for Android Developers Using Git
SCM for Android Developers Using Git
Tony Hillerson
 
First Android Experience
First Android ExperienceFirst Android Experience
First Android Experience
Tony Hillerson
 
iPhone Persistence For Mere Mortals
iPhone Persistence For Mere MortalsiPhone Persistence For Mere Mortals
iPhone Persistence For Mere Mortals
Tony Hillerson
 
Flex Framework Smackdown
Flex Framework SmackdownFlex Framework Smackdown
Flex Framework Smackdown
Tony Hillerson
 

More from Tony Hillerson (11)

Totally Build Apps for Free! (not really)
Totally Build Apps for Free! (not really)Totally Build Apps for Free! (not really)
Totally Build Apps for Free! (not really)
 
Working with Git
Working with GitWorking with Git
Working with Git
 
Dynamic Sound for Android
Dynamic Sound for AndroidDynamic Sound for Android
Dynamic Sound for Android
 
Git for Android Developers
Git for Android DevelopersGit for Android Developers
Git for Android Developers
 
Designing an Android App from Idea to Market
Designing an Android App from Idea to MarketDesigning an Android App from Idea to Market
Designing an Android App from Idea to Market
 
Rails on HBase
Rails on HBaseRails on HBase
Rails on HBase
 
SCM for Android Developers Using Git
SCM for Android Developers Using GitSCM for Android Developers Using Git
SCM for Android Developers Using Git
 
First Android Experience
First Android ExperienceFirst Android Experience
First Android Experience
 
iPhone Persistence For Mere Mortals
iPhone Persistence For Mere MortalsiPhone Persistence For Mere Mortals
iPhone Persistence For Mere Mortals
 
Flex Framework Smackdown
Flex Framework SmackdownFlex Framework Smackdown
Flex Framework Smackdown
 
Flex And Rails
Flex And RailsFlex And Rails
Flex And Rails
 

Recently uploaded

The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 

Recently uploaded (20)

The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 

Flex With Rubyamf

  • 1. Flex and Rails Tony Hillerson Software Architect with RubyAMF EffectiveUI RailsConf
  • 4.
  • 5. Why Flex and Rails? They Make The Great Tag Team!
  • 7. What are the Options?
  • 8. XML
  • 9. XML is the Default Option
  • 10. # POST /contexts # POST /contexts.xml def create @context = Context.new(params[:context]) respond_to do |format| if @context.save flash[:notice] = 'Context was successfully created.' format.html { redirect_to(@context) } format.xml { render :xml => @context, :status => :created, :location => @context } else format.html { render :action => quot;newquot; } format.xml { render :xml => @context.errors, :status => :unprocessable_entity } end end end
  • 12. JSON is in Rails Too format.json { render :json => @context.to_json } http://as3corlib.googlecode.com var obj:Object = JSON.decode(jsonString)
  • 14. AMF is the Good Stuff Buck Thinks it’s Great!
  • 15. RubyAMF http://rubyamf.org http://rubyamf.googlecode.com
  • 16. Installing RubyAMF $ script/plugin install http://rubyamf.googlecode.com/svn/current/rubyamf • New File: app/controllers/rubyamf_controller.rb • New File: config/rubyamf_config.rb • config/initializers/mime_types.rb modified: Mime::Type.register quot;application/x-amfquot;, :amf • config/routes.rb modified: ActionController::Routing::Routes.draw do |map| map.rubyamf_gateway 'rubyamf_gateway', :controller => 'rubyamf', :action => 'gateway' end
  • 17. Con guring RubyAMF module RubyAMF module Configuration ClassMappings.translate_case = true ClassMappings.assume_types = false ParameterMappings.scaffolding = true ClassMappings.register( :actionscript => 'Task', :ruby => 'Task', :type => 'active_record', #:associations => [quot;contextquot;], :attributes => [quot;idquot;, quot;labelquot;, quot;context_idquot;, quot;completed_atquot;, quot;created_atquot;, quot;updated_atquot;]) end end
  • 18. Con guring RubyAMF ClassMappings.translate_case = false public var created_at:Date; ClassMappings.translate_case = true public var createdAt:Date; // created_at in rails
  • 19. Con guring RubyAMF ClassMappings.assume_types = true class Context < ActiveRecord::Base matches [RemoteClass(alias=quot;Contextquot;)] public class Context { for free
  • 20. Con guring RubyAMF ClassMappings.assume_types = false class Context < ActiveRecord::Base matches [RemoteClass(alias=quot;Contextquot;)] public class Context { with registration ClassMappings.register( :actionscript => 'Context', :ruby => 'Context', :type => 'active_record', :attributes => [quot;idquot;, ...])
  • 21. Con guring RubyAMF ParameterMappings.scaffolding = false def save becomes save(context); @context = params[0] ParameterMappings.scaffolding = true def save save( @context = becomes {context:context} params[:context] );
  • 22. Connecting to Rails via RubyAMF <mx:RemoteObject id=quot;contextsServicequot; destination=quot;rubyamfquot; endpoint=quot;http://localhost:3000/rubyamf_gateway/quot; source=quot;ContextsControllerquot; showBusyCursor=quot;truequot; /> public function save(context:Context):void { var call:AsyncToken = contextsService.save({context:context}); call.addResponder(responder); }
  • 24. 1. Generate and Migrate $ script/generate rubyamf_scaffold context label:string class CreateContexts < ActiveRecord::Migration def self.up create_table :contexts do |t| t.string :label t.timestamps end end def self.down drop_table :contexts end end $ rake db:migrate
  • 25. def load_all @contexts = Context.find :all respond_to do |format| format.amf { render :amf => @contexts } end end def save respond_to do |format| format.amf do if params[:context].save render :amf => params[:context] else render :amf => FaultObject.new(params[:context].errors.join(quot;nquot;)) end end end end
  • 26. 2. Sample Data work: id: 1 label: Work home: id: 2 label: Home anarco_syndicalist_commune_biweekly_meetings: id: 3 label: Anarcho-syndicalist Commune Bi-weekly Meetings
  • 27. 3. Test class Context < ActiveRecord::Base validates_presence_of :label class ContextTest < ActiveSupport::TestCase def test_context_without_label_fails non_label_context = Context.new assert !(non_label_context.save) error_messages = non_label_context.errors.on(:label) assert !(error_messages.empty?) end
  • 28. 4. Con gure ClassMappings.register( :actionscript => 'Context', :ruby => 'Context', :type => 'active_record', #:associations => [quot;tasksquot;], :attributes => [quot;idquot;, quot;labelquot;, quot;created_atquot;, quot;updated_atquot;])
  • 29. 5. Wire <mx:RemoteObject id=quot;contextsServicequot; destination=quot;rubyamfquot; endpoint=quot;http://localhost:3000/rubyamf_gateway/quot; source=quot;ContextsControllerquot; showBusyCursor=quot;truequot; /> <mx:RemoteObject id=quot;tasksServicequot; destination=quot;rubyamfquot; endpoint=quot;http://localhost:3000/rubyamf_gateway/quot; source=quot;TasksControllerquot; showBusyCursor=quot;truequot; />
  • 30. 5. Wire public function loadAll():void { var call:AsyncToken = service.load_all(); call.addResponder(responder); } public function save(context:Context):void { var call:AsyncToken = service.save({context:context}); call.addResponder(responder); } public function destroy(context:Context):void { var call:AsyncToken = service.destroy({id:context.id}); call.addResponder(responder); }
  • 31. 5. Wire public function execute(event:CairngormEvent):void { var evt:SaveContextEvent = event as SaveContextEvent; var delegate:ContextsDelegate = new ContextsDelegate(this); delegate.save(evt.context); } public function result(data:Object):void { var result:ResultEvent = data as ResultEvent; var context:Context = result.result as Context; ... }
  • 32. X. Rinse and Repeat
  • 34. Gem Plugin + Gem C Extension
  • 35. Gem Plugin C Extension
  • 36.
  • 39. Your Bob Father You Thanks! Tony Hillerson http://slideshare.com/thillerson http://github.com/thillerson http://thillerson.blogspot.com http://effectiveui.com Twitter: thillerson Brightkite: thillerson 39