【发布时间】:2016-10-22 22:01:13
【问题描述】:
我刚刚使用脚手架生成的帖子页面但它们不起作用当我尝试访问新帖子页面时,它给了我错误。
这是我的布局代码
<p style="color: green"><%= flash[:message] %></p>
<%= yield %>
我在尝试访问页面时遇到的错误
Processing PostsController#new (for 127.0.0.1 at 2016-10-23 02:45:19) [GET]
Rendering template within layouts/posts
Rendering posts/new
ActionView::TemplateError (undefined method `^' for "4":String) on line #12 of app/views/layouts/posts.html.erb:
9: </head>
10: <body>
11:
12:p style="color: green"><%= flash[:message] %></p>
13:
14: <%= yield %>
15:
app/views/layouts/posts.html.erb:12
app/controllers/posts_controller.rb:29:in `new'
<internal:prelude>:10:in `synchronize'
/home/atta/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/home/atta/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/home/atta/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
这是我在 ruby 1.9 中使用的 gem 列表
actionmailer (2.3.4)
actionpack (2.3.4)
activerecord (2.3.4)
activeresource (2.3.4)
activesupport (2.3.4)
bigdecimal (1.1.0)
bundler-unload (1.0.2)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
io-console (0.3)
json (1.5.5)
minitest (2.5.1)
rack (1.0.1)
rails (2.3.4)
rake (0.9.2.2)
rdoc (3.9.5)
rubygems-bundler (1.4.4)
rubygems-update (1.8.25)
rvm (1.11.3.9)
sqlite3 (1.3.12)
sqlite3-ruby (1.3.3)
注意:我也将我的 RubyGems 降级到 1.8.25,因为新版本无法使用 db:create rake 命令
【问题讨论】:
-
这些版本的 everything 多年来不受支持...出于常识的原因升级
-
我同意,但我正在准备我的环境来处理一个大型和旧项目
-
哇,那个版本的 Rails 已经 7 年多了。
-
我知道 .. 我很尴尬,但我需要设置这个环境才能使旧版 Rails 2.3 应用程序正常工作
标签: ruby-on-rails ruby ruby-on-rails-2