gpt4 book ai didi

ruby-on-rails - 我必须定义什么类型的列来生成文本区域 Ruby on rails

转载 作者:数据小太阳 更新时间:2023-10-29 08:49:46 24 4
gpt4 key购买 nike

我有一个包含以下迁移的“通知”表:

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/notifications/new 时,我在“Content”字段中看到了 input type="text"而不是文本区域。

已解决

最佳答案

在您的 View 文件中,将 content 字段定义为 text_area 而不是 text_field

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

关于ruby-on-rails - 我必须定义什么类型的列来生成文本区域 Ruby on rails,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15986617/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com