update survey json

This commit is contained in:
Aung Myo
2017-11-07 15:19:22 +06:30
parent 75118ef88b
commit 55943a2e33
3 changed files with 4 additions and 6 deletions

View File

@@ -19,12 +19,12 @@ class Origami::SurveysController < BaseOrigamiController
end end
def create def create
@dining_facility = DiningFacility.find(params[:table_id]) @dining_facility = DiningFacility.find(params[:table_id])
@url = "/origami/"+@dining_facility.type.downcase+"/"+params[:table_id] @url = "/origami/"+@dining_facility.type.downcase+"/"+params[:table_id]
@survey = Survey.new(survey_params) @survey = Survey.new(survey_params)
@survey.foreigner = params["survey"]["foreigner"].to_json
# respond_to do |format| # respond_to do |format|
if @survey.save if @survey.save
redirect_to @url redirect_to @url

View File

@@ -46,8 +46,6 @@ class Settings::CommissionsController < ApplicationController
# PATCH/PUT /commissions/1.json # PATCH/PUT /commissions/1.json
def update def update
respond_to do |format| respond_to do |format|
puts commission_params.to_json
puts "updddddddddddddddddddddd"
if @commission.update(commission_params) if @commission.update(commission_params)
format.html {redirect_to settings_commission_path(@commission), notice: 'Commission was successfully updated.'} format.html {redirect_to settings_commission_path(@commission), notice: 'Commission was successfully updated.'}
format.json {render :show, status: :ok, location: @commission} format.json {render :show, status: :ok, location: @commission}

View File

@@ -15,7 +15,7 @@
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<div class="form-group"> <div class="form-group">
<label>Foreigner</label> <label>Foreigner</label>
<select class="form-control col-md-12 selectpicker show-tick" name="survey[foreigner]" style="height: " > <select class="form-control col-md-12 selectpicker show-tick" name="survey[foreigner][][]" style="height: " >
<% Lookup.where("lookup_type = ?", "country" ).each do |ct| %> <% Lookup.where("lookup_type = ?", "country" ).each do |ct| %>
<option value="<%= ct.value %>"> <option value="<%= ct.value %>">
<%= ct.name %></option> <%= ct.name %></option>
@@ -27,7 +27,7 @@
<div class="form-group"> <div class="form-group">
<label>Number</label> <label>Number</label>
<input type="number" name="survey[foreigner]" class="form-control"> <input type="number" name="survey[foreigner][][]" class="form-control">
</div> </div>
</div> </div>
</div> </div>