[LRUG] Flex/Rails and downloading data to a file

Jon Gilbraith jon at professionalnerd.com
Thu Apr 29 01:07:51 PDT 2010


Yes, that's similar to how I've successfully served up files to a Flex app
(granted with send_file rather than send_data, and I don't know any of the
details of the Flex side of the implementation).

On 28 April 2010 17:23, Jordi Noguera Leon <jordinoguera83 at gmail.com> wrote:

> So, this *send_data @data, :type => 'application/x-amf', :filename =>
> "@filename, :disposition => 'inline' *should work?
>
>
>
> On 28 April 2010 16:23, Jon Gilbraith <jon at professionalnerd.com> wrote:
>
>> Jordi, you didn't mention the disposition there and if you don't specify
>> 'inline' it'll default to attachment and prompt you to save rather than
>> stream.
>>
>>
>> On 28 April 2010 15:56, Jordi Noguera Leon <jordinoguera83 at gmail.com>wrote:
>>
>>> hey!
>>>
>>> @Neil, I don't quite see what you're trying to say... The thing is so far
>>> there aren't any files, I have the contents of the file that should be
>>> downloaded, but from here to downloading an actual file I have no clue how
>>> to do it...
>>>
>>> @Ken, I've used send_data in other parts of the app where Flex wasn't
>>> used and calling it caused a dialog to appear in order to save a file
>>> (something like send_data(@my_data, :filename => :whatever)). So, what I was
>>> expecting was send_data to start a file download.
>>>
>>> Jordi
>>>
>>>
>>>
>>> On 28 April 2010 14:58, Kenneth Lee <kenfodder at gmail.com> wrote:
>>>
>>>>  Hey,
>>>>
>>>> send_data sends binary data, not getting the expected results doesn't
>>>> tell me much, can you find out what you are getting back? content-type
>>>> etc... Also what are you expecting back, json, xml, a file?
>>>>
>>>> I recommend using curl or even a browser to talk to rails via http and
>>>> see if the data is what you expect your Flex app to receive as really it's
>>>> just acting as an API.
>>>>
>>>> Also for the invalid auth token just remove protect_from_forgery from
>>>> you application controller, or at least that is where you should start as
>>>> that is where the error is originating from I believe.
>>>>
>>>> Hope this gets you started.
>>>>
>>>> Ken
>>>>
>>>> Jordi Noguera Leon wrote:
>>>>
>>>> Hi there!
>>>>
>>>>  I'm struggling to solve the following problem. We have an app with a
>>>> flex front end that displays some charts, each chart has a link to download
>>>> the data displayed in that chart. To do this I tried to call a rails method
>>>> that called send_data, but it didn't produce the expected results. It'd be
>>>> good if there was an easy way to do this directly from Flex...
>>>>
>>>>  I've also been trying to follow the steps explained in this article<http://flexonrails.net/?p=5>,
>>>> but I'm getting an Invalid Auth token error...
>>>>
>>>>  Does anyone have an idea?
>>>>
>>>>  Cheers,
>>>> Jordi
>>>>
>>>>
>>>>  ------------------------------
>>>>
>>>> _______________________________________________
>>>> Chat mailing listChat at lists.lrug.orghttp://lists.lrug.org/listinfo.cgi/chat-lrug.org
>>>>
>>>>
>>>> _______________________________________________
>>>> Chat mailing list
>>>> Chat at lists.lrug.org
>>>> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Chat mailing list
>>> Chat at lists.lrug.org
>>> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>>>
>>>
>>
>> _______________________________________________
>> Chat mailing list
>> Chat at lists.lrug.org
>> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>>
>>
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20100429/039a86ad/attachment-0003.html>


More information about the Chat mailing list