在Codeanywhere工作我使用# Annotate models
gem 'annotate'
更新Gem文件,然后使用我在宝石中看到的bundle update
:
Instaling annotate....
问题是当我使用$ annotate
时,我收到此错误代码
/home/cabox/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:443:in `load': /home/cabox/workspace/blog/app/controllers/posts_controller.rb:72: syntax error, unexpected ',', expecting tSTRING_CONTENT or tSTRING_DBE
G or tSTRING_DVAR or tSTRING_END (SyntaxError)
params.require(:post).permit(:title, :, :body)
^
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:443:in `block in load_file'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:633:in `new_constants_in'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:442:in `load_file'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:342:in `require_or_load'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:307:in `depend_on'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:225:in `require_dependency'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/engine.rb:468:in `block (2 levels) in eager_load!'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/engine.rb:467:in `each'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/engine.rb:467:in `block in eager_load!'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/engine.rb:465:in `each'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/engine.rb:465:in `eager_load!'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/engine.rb:346:in `eager_load!'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/annotate-2.7.1/lib/annotate.rb:147:in `eager_load'
from /home/cabox/.rvm/gems/ruby-2.1.2/gems/annotate-2.7.1/bin/annotate:195:in `<top (required)>'
from /home/cabox/.rvm/gems/ruby-2.1.2/bin/annotate:23:in `load'
from /home/cabox/.rvm/gems/ruby-2.1.2/bin/annotate:23:in `<main>'
from /home/cabox/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
from /home/cabox/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
我尝试使用bundle exec annotate
但是我还有其他错误。
答案 0 :(得分:3)
在posts_controller.rb
文件更改中:
params.require(:post).permit(:title, :, :body)
到
params.require(:post).permit(:title, :body)
问题在于冒号更改后的逗号并重新运行命令,问题将得到解决。