哈希和方括号的语法错误
Syntax error with hash and square brackets
我正在使用 Rails 4.1.6 和 Ruby 2.1.5。
我有以下代码,但出现错误:
params = {
input: @model.video.url,
test: true,
notifications: [zencoder_url],
pass_through: @model.id
outputs: [
{
public: true,
base_url: base_url,
filename: "mp4_" + filename_without_ext + '.mp4',
label: 'webmp4',
format: 'mp4',
audio_codec: 'aac',
video_codec: 'h264'
},
{
public: true,
base_url: base_url,
filename: "web_" + filename_without_ext + '.webm',
label: 'webwebm',
format: 'webm',
audio_codec: 'vorbis',
video_codec: 'vp8'
},
{
public: true,
base_url: base_url,
filename: "ogv_" + filename_without_ext + '.ogv',
label: 'webogv',
format: 'ogv',
audio_codec: 'vorbis',
video_codec: 'theora'
},
{
thumbnails: {
public: true,
base_url: base_url,
filename: "thumbnail_" + filename_without_ext,
times: [3],
aspect_mode: 'preserve',
width: '100',
height: '100'
}
}
]
}
这是我在尝试访问我的应用程序中的任何页面时遇到的错误:
Started GET "/" for 127.0.0.1 at 2015-05-14 00:26:08 -0500
ActiveRecord::SchemaMigration Load (3.0ms) SELECT "schema_migrations".* FROM "schema_migrations"
User Load (6.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 57 ORDER BY "users"."id" ASC LIMIT 1
Processing by DashboardController#index as HTML
Completed 500 Internal Server Error in 12ms
SyntaxError - syntax error, unexpected tIDENTIFIER, expecting '}'
outputs: [
^
/app/uploaders/video_uploader.rb:102: syntax error, unexpected '}', expecting keyword_end:
什么可能导致此错误?语法对我来说似乎是合法的。我似乎没有遗漏任何大括号或方括号。
pass_through: @model.id
缺少,
。
我正在使用 Rails 4.1.6 和 Ruby 2.1.5。
我有以下代码,但出现错误:
params = {
input: @model.video.url,
test: true,
notifications: [zencoder_url],
pass_through: @model.id
outputs: [
{
public: true,
base_url: base_url,
filename: "mp4_" + filename_without_ext + '.mp4',
label: 'webmp4',
format: 'mp4',
audio_codec: 'aac',
video_codec: 'h264'
},
{
public: true,
base_url: base_url,
filename: "web_" + filename_without_ext + '.webm',
label: 'webwebm',
format: 'webm',
audio_codec: 'vorbis',
video_codec: 'vp8'
},
{
public: true,
base_url: base_url,
filename: "ogv_" + filename_without_ext + '.ogv',
label: 'webogv',
format: 'ogv',
audio_codec: 'vorbis',
video_codec: 'theora'
},
{
thumbnails: {
public: true,
base_url: base_url,
filename: "thumbnail_" + filename_without_ext,
times: [3],
aspect_mode: 'preserve',
width: '100',
height: '100'
}
}
]
}
这是我在尝试访问我的应用程序中的任何页面时遇到的错误:
Started GET "/" for 127.0.0.1 at 2015-05-14 00:26:08 -0500
ActiveRecord::SchemaMigration Load (3.0ms) SELECT "schema_migrations".* FROM "schema_migrations"
User Load (6.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 57 ORDER BY "users"."id" ASC LIMIT 1
Processing by DashboardController#index as HTML
Completed 500 Internal Server Error in 12ms
SyntaxError - syntax error, unexpected tIDENTIFIER, expecting '}'
outputs: [
^
/app/uploaders/video_uploader.rb:102: syntax error, unexpected '}', expecting keyword_end:
什么可能导致此错误?语法对我来说似乎是合法的。我似乎没有遗漏任何大括号或方括号。
pass_through: @model.id
缺少,
。