Monday, December 22, 2008

Flex and Rails: The Book is Here!

It's been a long time coming, and a lot of hard work, and it's finally happening. Flex on Rails, Building Rich Internet Applications with Adobe Flex 3 and Rails 2 is up in final form on Safari and due to be released in paper form soon.

Daniel and I spent a lot of weekends and nights and cajoled and prodded each other for just slightly less than a year, and we're both proud of the results. I hope to hear some feedback soon so we can tell how it's being received, but we've been glad to do our part to bring these two communities together.

8 comments:

rainyglade said...

I'm stuck trying to send email either from Flex directly or else through Rails, and there's nothing that I can find in the book - 'email' doesn't even show up in the index.

I have googled and can't find anything either.

I'd like to use a URLRequest with mailto: in the URL, and everything is fine except that what I want to put into the body of the message makes the QUERY_STRING more than 255 characters and Lotus Notes chokes over that request.

I have also tried setting the method to POST, but I can't figure out how to set up the data member of the URLRequest to reference my field in a URLVariables() that contains the body text.

Any help would be appreciated!

TIA
Louise

Tony said...

@rainyglade - Sending email is not a job for Flex. You'd want to get the contents to be sent to Rails and do the work there. Watch this RailsCast for more information on sending email from Rails: http://railscasts.com/episodes/61-sending-email

rainyglade said...

Thanks for the link to the screencast, Tony. I have sent email from Rails successfully before, without Flex, but where I'm stuck now is how to get from the Flex UI to Rails to perform the mailing.

I'm using REST on the Rails side, and currently I have a mailer class and a corresponding .rhtml file set up. When I enter a url in a browser, I get back the text of the email, so that part appears to be working.

I have also set up a controller for the mailer, thinking that when I use a RESTful URL in my HTTPService to trigger the show method, the appropriate mailer deliver method will be called.

Does this sound like the right approach? I haven't yet found anything that talks about linking an HTTPService in Flex with a mailer model in Rails. The fact that the mailer is a model makes this very awkward.

Thanks,
Louise

sfakuyi said...

Hi Tony,

Congratulations on your book and thanks for taking time to write such a great book.

I wanted to ask: Do you cover Adobe AIR/Rails in this book? I am not so much into Flex, but I'd like to build a Rails/AIR app - can I use your book for this? or is the flex content to heavy for my own need?

Thanks and I look forward to hearing from you soon

Tony said...

@rainyglade - What you should do is create a controller which has an action that sends the email. Then Flex should just send whatever is needed to send the emails, e.g. a list of email addresses, subject and body contents.

You shouldn't call from Flex directly to a mailer.

Am I understanding your problem correctly?

Tony said...

@sfakuyi - by AIR, I assume you mean AIR built with HTML. We don't cover any AIR with HTML in the book, but we do have some examples at flexonrails.com.

If you're interested in AIR with Flex, then most of what we talk about in the book is helpful for either browser or AIR.

rainyglade said...

Tony,

Yes, you understood what I was asking. I have email working now, so thanks for your help.

Louise

rainyglade said...

Great book, btw. I especially like the chapter on Fluint.

Louise