我使用方法调用flash成功导出CSV但我收到错误

时间:2016-04-09 19:29:46

标签: ruby-on-rails csv

customers_controller.rb

  def export
@customers =Customer.all

flash[:success] = "Script ran successfully"
end

当错误消息说出语法错误,意外的keyword_do,期望keyword_end flash [:success] ="脚本成功运行"做|格式| ^。 我试图使用flash成功方法从我的数据库导出cvs文件。我看看rails cast,但它无法解决这个问题 index.html.erb

 <p><%= button_to 'export Import', scripts_export_data_path %></p>

1 个答案:

答案 0 :(得分:0)

检查语法并阅读错误(正如Zabba在评论中提到的那样)。你会想要类似的东西:

var Radium = require('radium');
var React = require('react');

@Radium
class Grabby extends React.Component {
  render() {
    return (
      <div style={style}>
        {this.props.children}
      </div>
    );
  }
}

var style = {
  cursor: "grab" // this will get autoprefixed for you!
};

请注意FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); params.gravity = Gravity.BOTTOM; titleTextView.setLayoutParams(params); n1.addView(titleTextView); respond_to do |format| format.csv { render text: @customers.to_csv } flash[:success] = "Script ran successfully" end 是如何存在的。请务必阅读您的错误消息,因为它们非常有用。