Dec 17 2006

Part 2 – Flex Cairngorm/WebORB Issue Tracker Tutorial – Getting Typed Objects from Rails using [RemoteClass]

Tag: Flex and Rails, tutorialDerek Wischusen @ 1:41 am

This is the second post in a series that covers certain features of Issue Tracker sample app that I added to the Flex RoR SDK.

The first post explained how to set up the application.

This post covers how you can get WebORB for Rails to return typed objects to Flex using the [RemoteClass] metadata tag.

One of the many design patterns that comprises the Cairngorm microarchitecture is the Value Object pattern.  Value Objects are used to represent the ‘things’ that you are working with in your application.  For example, in the Issue Tracker sample app (view, source) there are currently Value Objects for Users, Projects, and Issues.  The class definitions for all of these objects can be found in com.rxr.issuetracker.vo package.

Value Objects on the client generally map to server-side objects.  In the Issue Tracker sample app all of the Value Objects listed above map to ActiveRecord classes in Rails, which in turn wrap tables in the database.  For instance, the IssueVO class in Flex maps to the Issue class in Rails (see C:\rails\rails_issue_tracker2\app\models\issue.rb) which wraps the issues table in the database.

This is the IssueVO class in Flex:

package com.rxr.issuetracker.vo
{
         import com.adobe.cairngorm.vo.IValueObject;

  	[Bindable]
 	[RemoteClass(alias="com.rxr.issuetracker.vo.Issue")]
 	public class IssueVO implements IValueObject
 	{
  		public var id : int;
  		public var project_id : String;
  		public var reportedby : String;
  		public var assignedto : String;
  		public var description : String;
  		public var status : String;
  		public var priority : String;
  	}
 }

Which maps to:


class Issue < ActiveRecord::Base
end



Which wraps the issues table:

issue_table2

Prior to WebORB 1.0.9 this mapping was only conceptual, in that Rails would only return untyped objects or ObjectProxys that would have to be 'manually' converted to Value Objects on the client side. Since WebORB 1.0.9 it is now possible to directly map ActiveRecord classes to classes on the Flex side using the [RemoteClass] metadata tag in Flex.

Making this happen is pretty straight-forward:

First, you need to add a [RemoteClass(alias="")] metadata tag just above the class definition of the ActionScript class that you want mapped to an ActiveRecord class.

[Bindable]
[RemoteClass(alias="com.rxr.issuetracker.vo.Issue")]
 public class IssueVO implements IValueObject
{

Next, go to C:\rails\rails_issue_tracker2\config and open weborb-config.xml. In this file you need to specify the mapping between your client-side class and your server-side class. For example, the following xml maps the IssueVO class on the client to the Issue class on the server. Note that you use the string specified in the alias of the [RemoteClass] metadata tag as the value of the clientClass in the class mapping.

<classMapping>
      <clientClass>com.rxr.issuetracker.vo.Issue</clientClass>
      <serverClass>Issue</serverClass>
      <source>Issue</source>
</classMapping>

That's it. Now when you make a service call to a method that returns Issue objects in Rails, those objects are automatically returned as IssueVOs to Flex.

vo_debugger


Dec 11 2006

Part 1 – Flex Cairngorm/WebORB Issue Tracker Tutorial

Tag: Flex and Rails, tutorialDerek Wischusen @ 1:34 am

This is the first in a series of posts/tutorails that will cover certain features of the Issue Tracker sample app that I recently released.

Future posts will cover:

  • How to return typed objects from Ruby on Rails using WebORB.
  • How to use active record associations.
  • How to use dynamic finders inside of Flex.
  • Anything else that you tell me you would like me to cover….

This post will cover how to set up and run the application in Flex.

 

Prerequisites

Recommended

First, if you haven’t already, download the source for the application: http://flexonrails.net/flex_ror_sdk_issue_tracker2.zip. 

Unzip it, then put the rails_issue_tracker2 folder into C:\rails

Next, start up Flex Builder.  Click on the File menu and select New->Flex Project

In the interface that appears, select Flex Data Services and Compile Application locally in Flex Builder. 

Then click Next>

 

Step 1

 

Fill in the next screen as follows:

Then click Next>

 

Step 2

 

On the following screen, enter flex_issue_tracker2 for the Project name.

Click Next>

 

Step 3

 

You need to add the Cairngorm.swc to your libraries for this project.  The Cairngorm.swc was is included in the source files for this project.  You can find it here: flex_ror_sdk_issue_tracker2\Flex_Source\flex_issue_tracker2\cairngorm. 

Take the .swc file and put it in a folder of your choice.

Then click Add SWC and browse to folder that you put the swc in.

 

Step 4 

 

On the same screen, fill in the form as follows:

Click Finish

 

Step 5

 

Next, open the following folder in the source files: flex_ror_sdk_issue_tracker2\Flex_Source\flex_issue_tracker2

Select the folders and files shown below and add them to the flex_issue_tracker2 project that you just created.

That takes care of the Flex side of things.  Now all you need to do is set up the database and tell the Rails app how to access it.

 

Step 6 

 

If you are using MySQL, open up the MySQL Command Line Client and enter:

CREATE DATABASE issue_tracker;

 

Step 7

 

Next, go to the config folder in your Rails app (rails_issue_tracker2\config) and open database.yml.

Fill in your username and password for your database where indicated below.

 

Step 8 

 

Now that your Rails app can access your database, it’s time to create the tables using Rails migrations.  You can see the files that define the tables by going to rails_issue_tracker2\db\migrate.

Open a command line and point it to your Rails app folder (c:rails\rails_issue_tracker2) and enter

rake migrate

Ok, the tables have been created and the app is ready to go.  All that remains to do is to boot up the server and test it out.  On command line enter

ruby script/server (or mongrel_rails start if you are using Mongrel).

 

Step 9

 

Lastly, go back into Flex Builder, click Run Debug(F11), and you should see the screen displayed below.

 

Step 10

 

Let me know if you have any questions, or if anything in this post is unclear or incorrect.


Dec 08 2006

Cairngorm/WebORB Issue Tracker Sample App Up and Running (for real this time)

Tag: Flex and Rails, RailsDerek Wischusen @ 5:24 pm

Ok, this time it should actually work.

http://apps.flexonrails.net/examples/

You can read more about this app in my previous post.

You can get the source for this app, and learn a little about what is going inside, by going to this post: http://flexonrails.net/?p=31
 


Dec 05 2006

Cairngorm/WebORB Issue Tracker Sample App Up and Running

Tag: Flex and RailsDerek Wischusen @ 4:22 am

I’ve set the issue tracker sample application that I recently added to Flex RoR SDK up on my site.

With this sample app you can:

  • Register to create a new account/login to an existing account.
  • Create/update/delete projects.
  • Create/update/delete issues.

You can check it out here: http://apps.flexonrails.net/examples/

Let me know if you have any questions or if you find any bugs.

Note: Once you’ve created a new project you can open it by double-clicking it.


Dec 01 2006

Flex Ruby on Rails Sample App that uses Cairngorm 2.1 and WebORB

Tag: Flex and RailsDerek Wischusen @ 7:37 pm

I recently updated the issue tracker sample application in the Flex RoR SDK so that it uses Cairngorm 2.1 and WebORB for Rails.

Besides showing how WebORB and Cairngorm can work together, this app demonstrates how to:

  • use active record associations.
  • return typed ValueObjects objects from Rails using the [RemoteClass] metadata tag.
  • use dynamic finders inside Flex by directly mapping a Service to a ActiveRecord class.
  • do simple effects in Flex.
  • use states and transitions.

You can get the source here

Let me know if you have any questions or comments, or if you find any bugs.

Credits:

The reflection on the login screen is by Ben Stucki.


Dec 01 2006

Source Code for Flex RoR Image Converter

Tag: UncategorizedDerek Wischusen @ 3:14 am

I’ve finally gotten around to adding the source code for the image converter sample app to the Flex RoR SDK.

You can download the full SDK at the google code site or if you just want source for the image converter then you can get it here.

Please let me know if you have any questions or comments.


Generic viagra for sale
Overnight delivery viagra
Cialis discount price
Phentermine canadian pharmacy
Viagra without prescription uk
Tramadol online no prescription overnight
Cheap generic valium
Where to buy propecia in canada
Where to buy viagra in england
Buy viagra australia
Propecia cheap
Cheap phentermine without prescription
Get viagra
Purchase cialis without a prescription
Valium no rx
Buy viagra online in australia
Where can i buy viagra without a prescription
Buy cialis uk
Phentermine purchase online
Buy generic cialis uk
Drug phentermine
Cheap valium online
Purchase tramadol online
Valium from india
Buy phentermine 37.5mg online
Buy phentermine no rx
Viagra super active
Propecia uk pharmacy
2mg xanax no prescription
Viagra pharmacy uk
Cialis for sale
Low cost cialis
Tramadol india
Generic viagra sales
Levitra online
Prescription viagra uk
Viagra in the uk
Cialis soft tabs online
Prescriptions for phentermine
Buy viagra in canada online
Viagra no prescription online
Levitra on sale
Propecia cost
Viagra 50mg side effects
Cheap viagra online without prescription
Cheap cialis india
Phentermine 37.5 wholesale
Levitra purchase
Phentermine canada no prescription
Viagra tablets for sale
Where can i buy viagra in the uk
Cialis side effects
Viagra online shop
Buy levitra
Generic levitra uk
Where to buy cialis safely
Buy cialis brand
Viagra in usa
Online prescription tramadol
Propecia best prices
Propecia generic cost
Levitra samples
Purchase levitra online
Cialis order canada
Levitra online buy
Purchase xanax
Buying viagra in new zealand
Phentermine 37.5 buy online
Buy generic valium online
Viagra buy online no prescription
Buy xanax online without prescription
Side effects of viagra
Order xanax cod
Best prices for cialis
Phentermine buy australia
2.5mg cialis
Best price tramadol
Viagra price canada
Propecia online uk
Cialis 10mg side effects
Viagra purchase uk
Xanax no rx
Buy valium europe
Valium without prescription uk
Generic xanax xr
Valium online overnight
Propecia information
Viagra canada mastercard
Buy generic valium
Best viagra dose
Discount viagra pills
Viagra online cheap
Buy tramadol hydrochloride
Propecia 1mg generic
Phentermine 37.5 pills
Xanax 1mg
Buy valium cheap online
Buy viagra 100mg
Viagra shop online
Best way to take tramadol
Xanax overnight cod
Order phentermine online no prescription
Generic cialis tadalafil
Buy phentermine no script
Phentermine cheap online
Cheapest online cialis
Order cheap viagra online
Buy phentermine online no prescription
Authentic phentermine 37.5
Buy propecia online without a prescription
Buy female viagra without prescription
Cheap cialis soft tabs
Buy viagra in england
Viagra indian pharmacy
Viagra fast delivery
Valium drug side effects
Viagra in france
Cheap cialis viagra
Low cost levitra
Buy propecia cheap
Cialis ordering
Valium 10 mg
Tramadol for sale
Cialis prescription cost
10mg prednisone
Generic viagra super active
Phentermine with no prescription
Buy generic cialis online
Xanax with no prescription
Buy cialis in the uk
Phentermine buy uk
Best way to buy viagra online
Xanax no prescription required
Purchase tramadol without prescription
100mg tramadol online
Cialis purchase online
Buy xanax 2mg no prescription
Cialis 20 mg dosage
Propecia price australia
Viagra express delivery
Cheap xanax for sale
Generic propecia
Xanax no prescription overnight
Cheap 37 5 phentermine
Blood pressure and prednisone
Levitra online cheap
Buy viagra online cheap
Cheap propecia without prescription
Prescription free viagra
Best viagra alternative
10mg valium effects
Phentermine hcl without prescription
Viagra lowest prices
Buy xanax overnight
Viagra online without prescription reviews
Where to buy viagra online
Propecia price
Purchase phentermine
Buying levitra without prescription
Online prescriptions xanax
Levitra us
Order tramadol cod
Buy phentermine 37.5mg pills
Buying valium in spain
No prescription valium
Buy viagra uk no prescription
Buy phentermine hcl 37.5 no prescription
How to buy phentermine online
Dosage of xanax
Buy cheap viagra online uk
Where to buy cialis online
Cheap cialis
Buy cialis online from canada
Where can i buy viagra without prescription
Valium generic
Best price on phentermine
Order tramadol online overnight
Tramadol online overnight
Buy cheap valium online
Buying cialis online without a prescription
Free samples of cialis
Propecia uk prices
Australia viagra prescription
Prednisone 20mg side effects
Buy tramadol hcl
Cialis 20mg side effects
Propecia ireland
Buy xanax canada
Fedex tramadol
Tramadol no prescription required
Order prednisone no prescription
Buy generic propecia uk
Tramadol without prescription
Prednisone tablets
Cheapest place to buy viagra online
Viagra prescription
Phentermine without a prescription
Ordering cialis online
Viagra to buy
Brand viagra cheap
Xanax price per pill
Low price cialis
Xanax bars dosage
Cost of viagra 50mg
Buy levitra online canada
Free cialis samples
Viagra prescription cost
Ordering propecia from canada
Buy generic cialis
Tramadol medication
Buy generic phentermine online
Valium online uk
Cheap tramadol cod
Cialis cialis
Buy viagra uk online
Tramadol pharmacy
Canada viagra
Valium online pharmacy
Viagra dosage information
Viagra in the philippines
Genuine viagra online
Online valium without prescription
Levitra canada
Prescription viagra canada
Prednisone 40 mg
Where can i buy cialis without a prescription
Canada pharmacy valium
Cheap generic viagra
Cialis dosage 20mg
Prednisone tablets 10 mg
Generic xanax no prescription
Valium pill 10mg
Viagra generic
Viagra discount coupons
Viagra professional online
Phentermine 37.5mg
Cialis online canadian pharmacy
Viagra canadian online pharmacy
Overnight tramadol no prescription
Xanax buy uk
Buy pfizer viagra without prescription
Buy viagra online uk no prescription
Generic cialis overnight
Viagra 50 mg online without prescription
Cheap cialis pills
40 mg prednisone side effects
Cialis prices uk
Prescription valium
Buy phentermine online without prescription
Overnight xanax delivery