You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Grape for some of my APIs. I am trying to implement an export API. Now I am getting an error like: undefined method 'zipline' for #<Class:0x000000012385c270> in '/api/test/:id/export' endpoint
My API resource is:
class Test < Api
# enable zipline
include Zipline
resource :test do
get '/export' do
files = JSON.parse Test.find(params[:id]).exportfiles
zipline(files, "zip_file_name")
end
end
end
The text was updated successfully, but these errors were encountered:
Sadly Grape does not support ActionController methods, so zipline() won't work there. The Zipline module relies on a number of methods being available on ActionController and uses them. You need to do some work to wire zipline (and zip_kit) into Grape. I suspect it can be done somewhat like so (I doubt that JSON.parse in your code is appropriate, what does exportfiles return exactly?):
I am using Grape for some of my APIs. I am trying to implement an export API. Now I am getting an error like:
undefined method 'zipline' for #<Class:0x000000012385c270> in '/api/test/:id/export' endpoint
My API resource is:
The text was updated successfully, but these errors were encountered: