我正在尝试制作一个像这样的非常简单的Rails程序。首先,我通过以下命令在Rails中做了一些事情:
rails generate scaffold Product \ title:string desciption:text image_url:string price:decimal
似乎一切运行正常,然后我运行了该命令rails db:migrate
没问题,但是当我运行rails server
时遇到了这些问题
=> Booting Puma
=> Rails 6.0.1 application starting in development
=> Run rails server --help for more startup options
*** SIGUSR2 not implemented, signal based restart unavailable!
*** SIGUSR1 not implemented, signal based restart unavailable!
*** SIGHUP not implemented, signal based logs reopening unavailable!
Puma starting in single mode...
* Version 4.3.0 (ruby 2.6.4-p104), codename: Mysterious Traveller
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://[::1]:3000
* Listening on tcp://127.0.0.1:3000
Use Ctrl-C to stop
Started GET "/products" for ::1 at 2019-12-03 14:29:37 +0700
(3.0ms) SELECT sqlite_version(*)
(0.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
SyntaxError (C:/Users/xxx/Desktop/xxx/X/app/controllers/products_controller.rb:72: syntax error, unexpected backslash, expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END
...ams.require(:product).permit(:\, :title, :desciption, :image...
...^):
app/controllers/products_controller.rb:72: syntax error, unexpected backslash, expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END
app/controllers/products_controller.rb:72: syntax error, unexpected backslash, expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END
app/controllers/products_controller.rb:72: syntax error, unexpected backslash, expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END
因为这个问题,我感到非常困惑吗?我是新手,正在尝试制作一个简单的程序,所以请帮助我,非常感谢。
答案 0 :(得分:1)
根据错误,#def system_specific_test_config(env): Deleted This Line
"""Add default test flags required for TF tests to bazelrc."""
def system_specific_config(env): #Added this Line
"""Add default build and test flags required for TF tests to bazelrc."""
write_to_bazelrc('test --flaky_test_attempts=3')
write_to_bazelrc('test --test_size_filters=small,medium')
write_to_bazelrc(
@@ -1520,6 +1520,10 @@ def system_specific_test_config(env):
elif is_macos():
write_to_bazelrc('test --test_tag_filters=-gpu,-nomac,-no_mac')
write_to_bazelrc('test --build_tag_filters=-gpu,-nomac,-no_mac')
# TODO(pcloudy): Remove BAZEL_USE_CPP_ONLY_TOOLCHAIN after Bazel is upgraded
# to 0.24.0.
# For working around https://github.com/bazelbuild/bazel/issues/7607
write_to_bazelrc('build --action_env=BAZEL_USE_CPP_ONLY_TOOLCHAIN=1')
elif is_linux():
if env.get('TF_NEED_CUDA', None) == '1':
write_to_bazelrc('test --test_tag_filters=-no_gpu')
@@ -1747,7 +1751,7 @@ def main():
create_android_ndk_rule(environ_cp)
create_android_sdk_rule(environ_cp)
#system_specific_test_config(os.environ) #Deleted this Line
system_specific_config(os.environ) #Added this Line
if get_var(
environ_cp, 'TF_CONFIGURE_APPLE_BAZEL_RULES',
的这一行有错字
products_controller
从列表中删除params.require(:product).permit(:\, :title, ...)
,然后重试。