Skip to content

Instantly share code, notes, and snippets.

@YoshitsuguFujii
YoshitsuguFujii / multiselect
Created June 1, 2015 11:25
複数選択失敗作
class MultiSelectWithoutCtrl
constructor: (_this, options)->
@id = null
@name = options["name"]
@select = _this
@checkboxes = $("<div class='hidden_multi_select'></div>")
@select.after(@checkboxes)
@selected()
selected: ->
@select.on "click" , (event) =>
# frozen_string_literal: true
module Refinements
module AssociationCollectionExtension
refine ActiveRecord::Associations::CollectionProxy do
def find_or_build_by(arguments)
find_by(arguments) || build(arguments)
end
def detect_or_build_by(arguments)
self.detect do|instance|
#! /usr/bin/env ruby
exec("LANG=ja_JP.sjis grep -rn `echo #{ARGV[0]} | nkf -s` #{ARGV[1]} | nkf -w")