Skip to content

Instantly share code, notes, and snippets.

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <DHT.h>
#include <DHT_U.h>
#include <Adafruit_Sensor.h>
#include "DHT.h"
<%= form_for(@system) do |f| %>
...
<%= f.fields_for :system_components_attributes do |p| %>
<%= p.collection_select(:component_id, Component.all, :id, :name, {prompt: :true, include_hidden: false}, {:multiple => true}) %><br>
<% end %>
...
require 'ruby_nlp/ngram'
class Corpus
def initialize(glob, klass)
@glob = glob
@klass = klass
end
def files
@files ||= Dir[@glob].map do |file|
<%= form_for(@projection) do |f| %>
<% if @projection.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@projection.errors.count, "error") %> prohibited this projection from being saved:</h2>
<ul>
<% @projection.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
undefined local variable or method `survey_questions_attributes' for #<SurveysController:0x007fd175e9c098>
class Projection < ActiveRecord::Base
has_many :income_projections
has_many :incomes, :through => :income_projections
accepts_nested_attributes_for :income_projections
def update(post_params)
...
def new
@location = Location.all
@item = Item.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @item }
end
end
class Task < ActiveRecord::Base
belongs_to :project
end
Processing by ProjectionsController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"OtMaPeeiYzRVjXgSbTs4Jp/uNl5oAzfHCdQm/72y6eY=", "projection"=>{"name"=>"6 months", "incomes_attributes"=>{"0"=>{"name"=>"cool", "amount"=>"32323"}}}, "commit"=>"Update Projection", "id"=>"1"}
Projection Load (0.1ms) SELECT "projections".* FROM "projections" WHERE "projections"."id" = ? LIMIT 1 [["id", 1]]
def projection_params
params.require(:projection).permit(:name,
incomes_attributes: [:id, :name, :amount, :projection_id]
)
end