2013-04-13 49 views
1

我有一个表的“通知”有以下迁移文本区域红宝石:什么类型我必须定义列产生在轨道上

class CreateNotifications < ActiveRecord::Migration 
    def change 
    create_table :notifications do |t| 
     t.integer :id 
     t.string :from 
     t.string :to 
     t.string :subject 
     t.text :content 
     t.string :interval_type 
     t.integer :interval 
     t.datetime :begin 
     t.datetime :end 
     t.timestamps 
    end 
    end 
end 

的问题是,当我去所有MyApplication /通知/新我在“内容”字段中看到输入类型=“文本”而不​​是文本区域。

解决

回答

2

在你的视图文件,定义content字段作为text_area而不是text_field

# app/views/notifications/new.html.erb 
# Change <%= f.text_field :content %> to <%= f.text_area :content %> 
相关问题