我有这个表格:
= form_for([:mobile,@disclosure], :html => {:id => "disclosure-form", :remote => true}) do |f|
%p
=f.label :display_as, (t :select_disclosure_type)
=f.select :display_as, options_from_collection_for_select(Disclosure.basics, :display_as,
:name, f.object.display_as)
%p
=f.label :notes, (t :notes)
=f.text_area :notes, :class => "#{validation_rules(:free_disclosure_notes)}", :rows => 5 , :id => "disclosure_notes_entry"
= buttonset({:submit_label => (t "buttons.influencers.disclosures.create"),:submit_css_class => "call-to-action",
:cancel_url => "#",:direction => :left_to_right})
到目前为止我有这个控制器:
def create
Rails.logger.debug "-"*100
Rails.logger.debug session.inspect
Rails.logger.debug "-"*100
provider = nil
@disclosure = params[:disclosure-form].blank?
resource = build_resource({})
begin
if disclosure.nil?
print "hello 1"
else
print "hello 2"
end
rescue Exception => ex
Rails.logger.debug ex
end
respond_to do |format|
format.html{}
end
end
但我不确定如何填充 @disclosures 对象以便将其插入数据库?
如何从表单中获取正确的数据并将其添加到数据库中?
谢谢!!