Skip to content

Instantly share code, notes, and snippets.

@BrianJakovich
BrianJakovich / Ansible-role-accountants
Created May 14, 2020 16:41
Ansible-role-accountants
---
- name: Include variables
include_vars: main.yml
- name: Install GnuCash (Quickbooks alternative)
win_chocolatey:
name: gnucash
state: present
version: '3.10'
ignore_checksums: yes
@BrianJakovich
BrianJakovich / ansible-role-windows-baseline
Created May 14, 2020 16:38
ansible-role-windows-baseline
---
- name: Include variables
include_vars: main.yml
- name: Install AWS Tools for Windows PowerShell 1.1.1120.20130916
win_chocolatey:
name: awstools.powershell
state: present
version: '1.1.1120.20130916'
ignore_checksums: yes
@BrianJakovich
BrianJakovich / workspaces-image-factory
Created May 14, 2020 16:35
workspaces-image-factory
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
DomainName:
Description: FQDN of the domain for this directory
Type: String
Default: corp.verticalrelevance.com
SimpleADShortName:
Description: Netbios name of the domain for this directory
Type: String
Default: corp
<%= simple_form_for @report, html: { multipart: true } do |f| %>
<%= f.input :customer %>
<%= f.fields_for :roles do |builder| %>
<p>
<%= builder.label builder.object.name %>
<%= builder.text_field :emails %>
</p>
<% end %>
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
attr_accessible :admin, :email, :password, :password_confirmation
has_many :organization_reports, :dependent => :destroy
$('form#reportcheck').submit(function(){
var valuesToSubmit = $(this).serialize();
$.ajax({
type: "POST",
url: $(this).attr('action'), //sumbits it to the given url of the form
data: valuesToSubmit,
dataType: "JSON" // you want a difference between normal and ajax-calls, and json is standard
}).success(function(json){
console.log("success", json);
});
[0,1,2,3,4].each do |number|
ReportCheck.where(report_id: @report.id).each do |report_check|
ReportCheck.find(report_check.id).update_attributes(score: number)
end
end
$(function(){
$("form").submit(function(event){
// this debugger should be hit when you click the submit button!
debugger;
});
});
Processing by ReportChecksController#update as JS
Parameters: {"utf8"=>"✓", "report_check"=>{"score"=>"4", "recommendation"=>"wwas", "analysis"=>"wwd2", "_destroy"=>"false"}, "commit"=>"Set Score", "id"=>"2"}
ReportCheck Load (1.0ms) SELECT "report_checks".* FROM "report_checks" WHERE "report_checks"."id" = $1 LIMIT 1 [["id", 2]]
(0.1ms) BEGIN
(0.1ms) ROLLBACK
Completed 500 Internal Server Error in 4ms (ActiveRecord: 1.2ms)
ActiveRecord::UnknownAttributeError (unknown attribute '_destroy' for ReportCheck.):
app/controllers/report_checks_controller.rb:4:in `update'
<div class="row">
<%= link_to "Edit", edit_report_path(@report), class: "btn btn-primary pull-right" %>
<%= link_to "PDF", report_path(@report, format: "pdf"), class: "btn btn-success pull-right" %>
</div>
<div class="items">
<% @report.report_checks.order(check_id: :asc).each do |report_check| %>
<div class="nested-fields">
<div class="item">
<%= form_for report_check, remote: true do |f| %>