【发布时间】:2012-03-07 10:47:02
【问题描述】:
我在我的 Ruby on Rails 项目中使用 Postgresql 数据库有一个 Question 模型,该数据库有一个名为 question 的字符串数据类型。 (原来嘿!)当我输入一些带有句号(。)的数据时,它不会在我的html / erb视图文件中正确打印/输出,句号之前的所有内容都丢失了!
<div class="field">
<%= f.label question.question %><br />
....
它根据 psql 控制台的以下输出正确存储在我的数据库中
select question from questions where "id"=1;
question
----------------------------------
What is 2+3. What is the answer?
(1 row)
有谁知道这里发生了什么(以及解决方法)?我已经尝试过诸如 .html_safe 和 .to_s 之类的东西,但无济于事。
编辑:关于 html 输出的另一个困扰我的事情是它摆脱了我所有的大写字母。靠?!
所以关于示例的 html 输出将在下面...
what is the answer?
【问题讨论】:
标签: html ruby-on-rails ruby-on-rails-3 postgresql