2016-12-28から1日間の記事一覧
ActiveRecordを利用して、MySQLのREGEXPを利用したい場合 class Book < ActiveRecord::Base scope :with_title_regexp, -> (pattern) { with_regexp(columns_hash['title'].name, pattern) } scope :with_regexp, -> (column, pattern) { where("`#{table_na…
ActiveRecordを利用して、MySQLのREGEXPを利用したい場合 class Book < ActiveRecord::Base scope :with_title_regexp, -> (pattern) { with_regexp(columns_hash['title'].name, pattern) } scope :with_regexp, -> (column, pattern) { where("`#{table_na…