Sha256: 0f8c79187f1036f0afb6a8f63498dba2d0c885fa3d1d39c1bc70c8de01a6b372
Contents?: true
Size: 581 Bytes
Versions: 2
Compression:
Stored size: 581 Bytes
Contents
require "procon_bypass_man/web/models/base_model" module ProconBypassMan module Web class Setting < BaseModel self.column_names = %w(root_path setting_path) self.table_name = :settings attr_accessor(*column_names) def self.find_or_create_by(*) rows = db.execute("select * from #{table_name}") if rows.size.zero? db.execute("insert into #{table_name} (#{column_names.join(", ")}) values (?, ?)", ['', '']) return new(['', '']) else return new(rows.first) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
procon_bypass_man-web-0.1.1 | lib/procon_bypass_man/web/models/setting.rb |
procon_bypass_man-web-0.1.0 | lib/procon_bypass_man/web/models/setting.rb |