So you're looking to spit back CSV? Here's some Agent stuff for the RESTification of evedb.info! the
RUBY:
-
@agents.collect{ |a| a}.each do |agent|
is for paginating_find to return all the Agents.
RUBY:
-
format.csv do
-
cols = Agent.columns.map(&:name).sort
-
csv_str = FasterCSV.generate do |csv|
-
csv.push cols
-
@agents.collect{ |a| a}.each do |agent|
-
row = []
-
cols.each do |k|
-
row.push agent.attributes[k]
-
end
-
csv.push row
-
end
-
end
-
render :text => csv_str

