Skip to content

Instantly share code, notes, and snippets.

View edwardmp's full-sized avatar
🚀

Edward Poot edwardmp

🚀
View GitHub Profile
@edwardmp
edwardmp / bootstrap_errors_for_associations.rb
Last active November 29, 2016 16:52
Automatic bootstrap form validation on *_id fields when validates :association, presence: true is present
BootstrapForm::FormBuilder.class_eval do
def association_object(name)
name = name.to_s
if name.end_with?('_ids')
# Check for a has_(and_belongs_to_)many association (these always use the _ids postfix field).
association = object.class.reflect_on_association(name.chomp('_ids').pluralize.to_sym)
else
# Check for a belongs_to association with method_name matching the foreign key column
association = object.class.reflect_on_all_associations.find do |a|
~ $ fastlane env
[20:15:10]: Generating fastlane environment output, this might take a few seconds...
<details><summary>🚫 fastlane environment 🚫</summary>
### Stack
| Key | Value |
| --------------------------- | ---------------------------------------------------------------- |
| OS | debian_based stretch/sid |
| Ruby | 2.4.0 |
require 'faraday' # HTTP Client
require 'faraday-cookie_jar'
require 'faraday_middleware'
require 'fastlane/version'
require 'logger'
require 'spaceship/babosa_fix'
require 'spaceship/helper/net_http_generic_request'
require 'spaceship/helper/plist_middleware'
require 'spaceship/ui'
require 'tmpdir'
blueprint:
name: Motion-activated Switch
description: Turn on a Switch when motion is detected.
domain: automation
author: edwardmp
input:
motion_entity:
name: Motion Sensor
selector:
entity: