「ruby rails プラグイン」の検索結果
RubyAMF」 から 次の単語がハイライトされています :


プラグイン

RubyAMF

このプラグインができること

  1. フロントエンドとなるFlashと、バックエンドとなる「何か」をつなぐためのAMF0またはAMF3を、Flash・RubyonRails間で使うためのプラグイン
  2. AMFはバイナリとしてデータ転送するので、大量のデータ転送時に効率が上がる(データ量や時間など)
  3. (自分自身まだよくわかってないものの)RPC的な使い方がメイン?
  4. ActionScript3用のFlash RemotingライブラリであるSuper Simple Remoting(http://ssr.riaforge.org/)を使うと、楽が出来る。

対象バージョン

1.2系

ちょー簡単な使い方

Rails
ruby script/plugin install http://rubyamf.googlecode.com/svn/trunk/
でインストールして、普通のコントローラーを作って
ruby script/generate controller sample
普通のコントローラーにアクションを定義して
class SampleController <ApplicationController
 def helloworld
   render :amf => "HelloWorld"
 end
end

Flash(Flex)側
Super Simple Remoting(http://ssr.riaforge.org/)をインストールして、アクションスクリプトで
import org.rubyamf.remoting.ssr.RemotingService;
import org.rubyamf.remoting.ssr.ResultEvent;
import org.rubyamf.remoting.ssr.FaultEvent;
public class Main extends Sprite {
 public function Main() {
   var serv:RemotingService = new RemotingService(
     "http://192.168.1.160:8181/rubyamf/gateway",
     "SampleController"
   );
   serv.helloworld([], on_result, on_fault);
 }
 private function on_result(evt:ResultEvent):void {
   trace(evt.result);
 }
 private function on_fault(evt:FaultEvent):void {
   trace("ERROR");
 }   
}
ってやると、
serv.helloworld([], on_result, on_fault);
により、Flash側からRails側のsampleControllerのhelloworldアクションがパラメータなしで呼ばれて、成功時ハンドラon_result,失敗時ハンドラon_faultのどちらかがコールされ、もし成功していたら
   trace(evt.result);
ではRailsから"HelloWorld"が渡ってくる。

もし
serv.create([ {last_name:last_name.text, first_name:first_name.text} ], on_result, on_fault);
とやると、Rails側ではsampleControllerのcreateアクションの中で
params[0][:first_name]
params[0][:last_name]
でアクセスできる。

公式ページ

http://code.google.com/p/rubyamf/
RubyForgeから引っ越したみたい
ここのサンプルソースも使えるかも。(まだ見てない)

日本語解説ページ

※チュートリアル風にRails→Flashでの受け取りまで。
※Flash(Flex)→Railsの呼び出し

外国語解説ページ

※本家以外で初心者用の良いチュートリアルは今のところ見つけられていない。てか、本家もあまりドキュメントとしては良くない。

のうはう

ええと、SSRに関する資料が不足しているな。
まず、ダウンロードとかsubversionリポジトリをチェック。

ここのサンプルソースは見ておくべし

カスタムエラー処理の書き方
あと、認証失敗処理も書けるみたい

一時的に
WebORBプラグイン
An alternative of BlazeDS - Rails and WebORB
※実現可能な事はRubyAMFと同じで、アプローが違うらしい


コメント

+ タグ編集
  • タグ:
  • plugin
  • flash
  • flex
  • amf
  • rubyamf
  • rails

このサイトはreCAPTCHAによって保護されており、Googleの プライバシーポリシー利用規約 が適用されます。

最終更新:1970年01月01日 09:00