Dec 11

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.

33 Responses to “Part 1 – Flex Cairngorm/WebORB Issue Tracker Tutorial”

  1. FlexOnRails.net got new turorial Cairngorm/WebORB an Flex at Web 2.0 Log says:

    [...] FlexOnRails.net is starting a couple of tuturials about their Issue Tracker Flex Application. The first part is about setting up the application and running it in Flex. [...]

  2. Niels says:

    I’ve got the problem, that everytime I change something in the WebORB service, I have to restart the server, otherwise the service isn’t updated to my new code.

    Do you got a solution to this problem?

  3. Derek Wischusen says:

    I have the same problem.

    You can try adding

    include Reloadable

    to your service classes. This has not worked for me (it causes an error), but you might want to give it a try.

  4. Niels says:

    include Reloadable also didn’t worked for me. I hope there will be a solution soon, because it gets very anoying.

  5. Mark Piller says:

    Niels and Derek,

    The \”Reloadable\” problem is now fixed. You can read more about it at: http://blog.themidnightcoders.com/2006/12/reloadable-reloaded-auto-reload-weborb.html

    Get the latest build (1.1.1) to see the change.

    Thanks,
    Mark

  6. Derek Wischusen says:

    Hi Mark,

    Thanks for the update. That is very good news.

  7. flexonrails.net » Blog Archive » Part 2 - Flex Cairngorm/WebORB Issue Tracker Tutorial - Getting Typed Objects from Rails using [RemoteClass] says:

    [...] The first post explained how to set up the application. [...]

  8. Vixiom Axioms » Flex & Cairngorn & Rails Demo App says:

    [...] FlexOnRails have two (first, second) detailed posts on using WebORB for Rails with Flex. The demo app uses Adobe’s Cairngorm a framework for Flex and it’s Value Objects which can be mapped to server side objects. Make sure to read the comments on the second post as Derek Wischusen explains the value of Value Objects. [...]

  9. Rudie says:

    Wow! I should get more into WebOrb! Thanx for making/sharing the tutorials.

  10. flexonrails.net » Blog Archive » Part 3 - Flex Cairngorm/WebORB Issue Tracker Tutorial - Using ActiveRecord Associations with WebORB says:

    [...] The first post explained how to set up the application. [...]

  11. thefactoryfactory · more info from Midnight Coders on RoR and Flex 2.0 says:

    [...] Part 1 [...]

  12. flexonrails.net » Blog Archive » Part 4 - Flex Cairngorm/WebORB Issue Tracker Tutorial - Invoking ActiveRecord Methods Directly From Flex says:

    [...] The first post explained how to set up the application. [...]

  13. New To Rails... says:

    when i start the server, i get this error:

    2007-01-26 12:33:10: (mod_fastcgi.c.1022) execve failed for: /Users/veracarr/Desktop/rails_issue_tracker/public/dispatch.fcgi No such file or directory
    2007-01-26 12:33:10: (mod_fastcgi.c.1048) the fastcgi-backend /Users/veracarr/Desktop/rails_issue_tracker/public/dispatch.fcgi failed to start:
    2007-01-26 12:33:10: (mod_fastcgi.c.1052) child exited with status 2 /Users/veracarr/Desktop/rails_issue_tracker/public/dispatch.fcgi
    2007-01-26 12:33:10: (mod_fastcgi.c.1055) if you try do run PHP as FastCGI backend make sure you use the FastCGI enabled version.
    You can find out if it is the right one by executing ‘php -v’ and it should display ‘(cgi-fcgi)’ in the output, NOT (cgi) NOR (cli)
    For more information check http://www.lighttpd.net/documentation/fastcgi.html#preparing-php-as-a-fastcgi-program
    2007-01-26 12:33:10: (mod_fastcgi.c.1060) If this is PHP on Gentoo add fastcgi to the USE flags
    2007-01-26 12:33:10: (mod_fastcgi.c.1356) [ERROR]: spawning fcgi failed.
    2007-01-26 12:33:10: (server.c.834) Configuration of plugins failed. Going down.

    i haven’t had this issue with any other rails apps. any suggestions? thanks in advance

  14. Robert Shiue’s Blog » Blog Archive » 第一次連WebORB says:

    [...] 就可以測試看看了! 參考: http://flexonrails.net/?p=34 [...]

  15. Robert Shiue’s Blog » Blog Archive » [Flex]Flex + ROR Great Tutorial says:

    [...] Part 1 – Flex Cairngorm/WebORB Issue Tracker Tutorial [...]

  16. Mike Britton says:

    I get a routing error when I launch the application — “no route found to match “/examples/Main.html” with {:method=>:get}”

  17. Derek Wischusen says:

    Hi Mike,

    Looks like the html file included in the source for the non-debug version is named main.html (lower-case m).

    If you go in to public/examples and rename the file to Main.html, that should solve the problem. Alternatively, you could launch the app in debug mode, which should also work.

    Derek

  18. Mike Britton says:

    I apologize – I had more than one webrick server running! Thanks for the outstanding tutorial.

  19. Joel says:

    Awesome. I got this working with the Rails eclipse plugin so that everything is stationed inside of Flex Builder.

    Who has the Rails hosting that will be kind to weborb? I have noticed, locally, unless I have the :3000 it dies. I remapped apache to my public dir, but it still fails with weborb unless I have the :3000. Plus all the reboots. Everytime I upload to my host, I get “send failed”. This is with the weborb tests.

  20. Derek Wischusen says:

    Hi Joel,

    The trick to getting WebORB running on your host is that you have to be able to restart the server once you’ve installed the WebORB plugin.

    I use A2hosting, who I highly recommend. To date, their support has been very good and I have not had any downtime (that I am aware of).

    To get WebORB working I had to set up a separate Mongrel server (the one at apps.flexonrails.net) that I could start/stop/reboot.

    So, A2 has been working well for me, but any host where you can set up separate Mongrel server should work.

    Derek

  21. Joel says:

    Unfortunately dreamhost, my preferred solution, won’t let users currently control individual mongrel servers. I tried railsplayground, but I was a little put off when I asked him about weborb and he replied that “Your page properly displays ‘Flash Plugin Needed’ – so what’s the problem?” I don’t have the vocabulary just yet to describe what I need.

    I don’t have a need for remote hosting just yet, but when the time comes I might pick your brain for specifics if that would be OK. Right now it runs like a treat locally, so I can get my learn on.

  22. shajahan says:

    hi,
    this is a great example for beginners. well i’ve a question i’m not able to track the service for users.the other two service for issueservuce and projectservice are available.can you tell me where the user service is present? and how’re u invoking the two functions in the user service?
    Thanks,
    Shajahan

  23. Derek Wischusen says:

    Hi Shajahan,

    The UserService in Flex is mapped directly to the User model class in Rails. So, the those methods are being invoked directly on the User class.

    Check out this post for more details: http://flexonrails.net/?p=54

    Derek

  24. jharbs.com » Ruby on Rails and Flex says:

    [...] are some very useful tutorials on how to implement the [...]

  25. Daniel says:

    Has anybody tried following this tutorial while using FlexBuilder 3? The new dialog window for setting up a Flex application is throwing me off: the options for server type are:
    Other/none
    PHP
    LiveCycle Data Services
    ColdFusion
    ASP.NET

    Not sure what one selects when using WebORB for RoR.

    Thanks,

    Daniel

  26. bartek says:

    In FlexBuilder 3 I’ve chosen LiveCycle Data Services (as I see they’re new Flex Data Services) but when I try to run this project I get:

    VerifyError: Error #1053: Illegal override of subtopic in mx.messaging.Consumer.
    at frame2
    at [abc-decode]
    at flash.display::MovieClip/nextFrame()
    at mx.managers::SystemManager/private::deferredNextFrame()
    at mx.managers::SystemManager/private::preloader_initProgressHandler()
    at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.preloaders::Preloader/private::timerHandler()
    at flash.utils::Timer/flash.utils:Timer::_timerDispatch()
    at flash.utils::Timer/flash.utils:Timer::tick()

    does anywone have a clue what i do wrong?

  27. Larry Bernstein says:

    Regarding the error you got:

    VerifyError: Error #1053: Illegal override of subtopic in mx.messaging.Consumer.
    at frame2

    I hit this problem and it was due to having put some LCDS specific libaries in the $FRAMEWORK and $LOCALES directories that you include in your project. I had been working with LCDS and instructions somewhere (I think a tutorial) told me to do this. Since I didn’t remember which files I added I reinstalled both Eclipse and the flex plugin which brought me back to the base files for running a flex project without LCDS. I no longer got this error. Hope that helps.

  28. abhishek says:

    here is not any explanation of code used in .as files

  29. Peter says:

    I only got far as the builder requirement – not available for linux
    :(

  30. Adobe Flex - Cairngorm « Panduramesh’s Weblog says:

    [...] Wischusen :: Flex Cairngorm/WebORB Issue Tracker Tutorial :: Part 1 :: Part 2 :: Part 3 :: Part 4 Published [...]

  31. anil4it says:

    [...] Wischusen :: Flex Cairngorm/WebORB Issue Tracker Tutorial :: Part 1 :: Part 2 :: Part 3 :: Part [...]

  32. Anilkumar says:

    [...] Wischusen :: Flex Cairngorm/WebORB Issue Tracker Tutorial :: Part 1 :: Part 2 :: Part 3 :: Part [...]

  33. It’s all about RIA says:

    [...] Wischusen :: Flex Cairngorm/WebORB Issue Tracker Tutorial :: Part 1 :: Part 2 :: Part 3 :: Part [...]

Leave a Reply