Sha256: 4e4f2c64530c54919892fe1e4995e9f067d8a1ef481c26ec3b960aa72831fca0
Contents?: true
Size: 578 Bytes
Versions: 2
Compression:
Stored size: 578 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(*) 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.3 | lib/procon_bypass_man/web/models/setting.rb |
procon_bypass_man-web-0.1.2 | lib/procon_bypass_man/web/models/setting.rb |