ビューに refile を接続しようとしていますが、次のエラーが発生します。
ここに私のモデルがあります:
class Job < ActiveRecord::Base
acts_as_paranoid
acts_as_taggable
acts_as_taggable_on :languages
belongs_to :company
belongs_to :category
validates :title,
:location,
:category,
:language_list,
:short_description,
:description,
:application_process,
presence: true
end
class Company < ActiveRecord::Base
acts_as_paranoid
has_many :jobs
attachment :company_logo, type: :image
validates :name, :url, :email, presence: true
end
そして simple_form ビュー (binding.pry は無視してください)
= render layout: 'header' do
= simple_form_for(@job) do |j|
div[class='panel-heading']
h3[class='panel-title']
|Position Details
div[class='panel-body']
= j.input :title
= j.input :location
= j.association :category, as: :radio_buttons
= j.input :language_list, as: :check_boxes, collection: @tags
= j.input :short_description
= j.input :description, input_html: { class: 'textarea-height wysihtml5' }
= j.input :application_process
div[class='panel-heading']
h3[class='panel-title']
|Company Details
div[class='panel-body']
= j.simple_fields_for :company do |jc|
= jc.input :name
= binding.pry
= jc.input :company_logo, as: :attachment
= jc.input :url
= jc.input :email
div[class='panel-heading panel-heading-info']
h3[class='panel-title']
|Would you like your job posting featured?
div[class='panel-body']
p
|Featured posted are promoted with additional design elements to grab the
job seeker's attention. This additional marketing capability can be purchased
for an additonal $#{AppConfig.product['settings']['job_base_featured_price']}.
= j.input :is_featured
= j.button :button, type: 'button', class: 'btn-primary' do
= job_posting_button_step_label
=>
i[class='fa fa-arrow-circle-right']
ドキュメントを解析している間、attachment_field
未定義の理由がわかりません。
また、次のように初期化子 refile.rb をセットアップしています。
require 'refile/rails'
require 'refile/simple_form'
これを次のように切り替えると、ドキュメントがめちゃくちゃになっているのか、simple_form の部分が壊れているのか疑問に思っています。
= jc.input :company_logo, as: :file, direct: true, presigned: true