在控制器方法错误中初始化哈希

时间:2017-07-23 10:21:43

标签: ruby-on-rails ruby

我的代码:

def edit
  @post = Post.find_by(slug: params[:id])

  options: {
    bucket:     'uploads',
    region:     'us-west-2',
    keyStart:   'uploads',
    acl:        'public-read',
    accessKey:   Rails.application.secrets.access_key_id,
    secretKey:   Rails.application.secrets.secret_access_key 
  }

  @aws_data = FroalaEditorSDK::S3.data_hash(options)
end

错误:

syntax error, unexpected ':', expecting keyword_end options: { ^

Doc reference

1 个答案:

答案 0 :(得分:3)

该文章中显然存在语法错误。变化

options: {

options = {

将哈希值分配给options变量。