0

ユーザーを作成するためにリストボックスにselect_tagを使用していますが、ユーザーは作成していますが、リストボックスから選択したオプションに対してデータベースにnull値が保存されています。

コードを表示:

    About     :
<div class="field">
  &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp &nbsp
  <%= select_tag "about_id",options_from_collection_for_select(@abouts, "id", "name"),:multiple =>true%>
</div>

コントローラ アクションの作成:

def create
    @student = Student.new(params[:student])
    respond_to do |format|
      if @student.save
      Query.query_confirmation(@student).deliver

       format.html { redirect_to :controller=>"students",:action=>"new", notice: 'Student was successfully created.' }
        flash[:notice]="Your Question has been sent to the University they will revert back soon"
        format.json { render json: @student, status: :created, location: @student }
      else
        format.html { render action: "new" }
        format.json { render json: @student.errors, status: :unprocessable_entity }
      end
    end
  end

助けていただければ幸いです。

4

0 に答える 0