I'd like to strongly disagree. While csv is not a great way to send
objects back and forth, it is a fantastic way to give reports to
users, since they can play around with them in Excel.

On Mar 5, 9:03 am, marco <[email protected]> wrote:
> All right, but, before, why would you do that? I think if you really
> need to use csv (eg. some legacy system), you would rather want to
> read from the csv file, turn it into object and serialize it with
> JSON. In the other end you'd do the opposit. I don't think csv is a
> good format to respond with, just a persistency format, very limited
> by the way.
>
> On Mar 4, 1:22 pm, olivernn <[email protected]> wrote:
>
>
>
>
>
>
>
> > In my controller I have an instance of a custom report class, the
> > instance responds to to_csv, which returns a csv string.  I was hoping
> > to be able to use respond_with, in the same way I would if I wanted a
> > json representation of this object.  Instead I see an error because
> > Rails is expecting there to be a template.
>
> > ActionView::MissingTemplate (Missing template admin/reports/trips with
> > {:formats=>[:csv], :handlers=>[:erb, :builder, :rjs, :rhtml, :rxml], 
> > :locale=>[:en, :en]}
> > in view paths
>
> > Is this the correct behaviour, I had a brief look through the rails
> > responder code and it looked to me like it should first try and render
> > a template, then if it can't find one try calling to_#{format}.
>
> > A sample of my code is in this gisthttps://gist.github.com/854903

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to