I created a small application using scaffold. I'm posting data via the chrome "PostMan" extension.
This is the default create method in my controller:
# POST /settings
# POST /settings.json
def create
@setting = Setting.new(setting_params)
respond_to do |format|
if @setting.save
format.html { redirect_to @setting, notice: 'Setting was successfully created.' }
format.json { render :show, status: :created, location: @setting }
puts Setting.new(setting_params).to_yaml
else
format.html { render :new }
format.json { render json: @setting.errors, status: :unprocessable_entity }
end
end
end
This is the log in Rails' console:
(0.2ms) begin transaction
SQL (1.0ms) INSERT INTO "settings" ("DetectionOnly", "SecRequestBodyAccess", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["DetectionOnly", "f"], ["SecRequestBodyAccess", "f"], ["created_at", "2016-03-23 18:04:42.642492"], ["updated_at", "2016-03-23 18:04:42.642492"]
I'm trying to only log this transaction into a file and save output in YAML format .
I tried adding this right after @setting.save.
puts Setting.new(setting_params).to_yaml
What am I doing wrong here?
settingstable is already there to hold the configuration isn't there?