Make sure you followed the post Installing Ruby On Rails plugin for FlashBuilder4 for installing the plugin and setting up of your Rails project before proceeding with the usage of the plugin from FlashBuilder.
Using the plugin from FlashBuilder4:
1. Create a new Flex Project.
-In the New Project Wizard, name the project, lets say "TestROR", select the application type and make sure that you enter Application Server type as None/Other, click next.
-Enter the output folder to be something under the publicly accessible directory under your rails project, ex: C:\RubyProjects\myrailsproject\public\TestROR, click next
-Enter the Output folder url as the url which points to the output folder created above ex: http://localhost:3000/TestROR
Exit the wizard by clicking finish.
2. Creating a new Service
- In the Data/Services Panel click Connect to Data/Service..., when the Connect to Data/Service wizard opens select "ROR" icon and click next.
- On the next page, select the services folder. The services folder is the directory under which any ruby class will be exposed as a service. For "WebOrb" as the AMF library this will reside under the app folder under the project folder. ex: C:\RubyProjects\myrailsproject\app\services
Provide the AMF endpoint. By default the plugin assumes that the AMF library is WebOrb and the user will be using the default destination. You can change it to provide the endpoint of the destination of your choice.
You can then select between creation of a new service or import of an existing service.
Selecting "Generate a new Ruby service class from a model" means that the plugin will generate a class exposing all the CRUD(create,read,update,delete) functions as a service for the mentioned model. This class will be placed under the already mentioned services folder.
You will then provide the name of the model. The name of the model is the same that is used in the common ruby command ruby script/generate model modelname . The model name here corresponds to the underlying database table. Rails naming convention makes the table name to end with a "s" while the model name does not have the "s" ex: If the table name is "Users" the model name will be "User".
You can then select if the model already exists or not. If you select that the model exists then the model class won't be generated, otherwise the user will then need to provide the directory where the model class will reside on generation. Generally it is under the app folder under the project folder ex: C:\RubyProjects\myrailsproject\app\models
Selecting "Import an existing Ruby service class" will simply import the mentioned class without any server side code generation. The ruby file location should be under the mentioned services folder for it to be exposed as a service.
3. Using the created service
The created service will appear in the Data/Services panel. All the operations in the service class and the model class will be imported.
If you selected ""Generate a new Ruby service class from a model" in the previous step you will find that the service is automatically created with DataManagement on the model as turned on, with the paging function also assigned.
If you selected otherwise only the operations will get listed and no data types will appear. All the operations will also be weakly typed (unknown input types and return types). You will have to manually configure the return types using Configure Return type... on right clicking on the operations.Using this service is same as using any other service under the DCD workflow in FlashBuilder4.
Find more about DCD service usage and data management at http://sujitreddyg.wordpress.com/flash-builder-4