StackOverFlow などでは Application Controller からでないと send_data は呼べないとか,Application Controller に実装してからそれを公開するのが良い というエントリーはあるのですが,そもそも Application Controller で send_data が呼べない事例となっております.
lang
1# Application controller 2class ApplicationController < ActionController::Base 3 # Prevent CSRF attacks by raising an exception. 4 # For APIs, you may want to use :null_session instead. 5 # protect_from_forgery with: :null_session 6 7 include ApplicationHelper 8 9 #protected 10 11 def self.send_csv(csv, options = {}) 12 send_data csv.to_s, options 13 end
発生するエラーは以下のような感じです.
lang
1error: "Internal server error: undefined method `send_data' for ......
環境は
ruby 2.1.2
AngularJs 1.2
です.
よろしくお願いいたします.
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2014/11/11 04:45