Учитывая следующий видНеправильный тип используется при использовании simple_form с реформой
class EntryForm < Reform::Form
property :composition
property :native_language_version
validates :composition, presence: true
end
и следующая схема
create_table "entries", force: :cascade do |t|
t.text "composition"
t.text "native_language_version"
t.integer "language_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
и следующий код контроллера
class EntriesController < ApplicationController
def new
@entry = EntryForm.new(Entry.new)
# @entry = Entry.new
end
end
и следующий код для simple_form
= simple_form_for(@entry) do |f|
= f.input :composition
= f.input :native_language_version
= f.submit
, а не получение textarea
для composition
и native_language_version
, я получаю
<input class="string required form-control" type="text" name="entry[composition]" id="entry_composition">
меняется с помощью @entry = Entry.new
дает мне текстовой элемент вместо этого, что то, что я хочу:
<textarea class="text optional form-control" name="entry[composition]" id="entry_composition"></textarea>
Я попытался добавив type: :text
к :composition
собственности в EntryForm
, но это не помогло.
Я также знаю, что вместо использования f.input
Я мог указать фактический тип ввода, но это взломать.
Как передать тот факт, что composition
является text
, а не string
через EntryForm
в simple_form?
Я использую Rails 4.2.5.1, simple_form 3.2.1 и reform 2.1.0.