I have DB class (SQLITE):
class CloudPbx::SipAccount < Sequel::Model(:cloud_pbx_sip_accounts)
alias id :uniqueid
def before_save
o = [('a'..'z'), ('A'..'Z'), ('0'..'9')].map { |i| i.to_a }.flatten
self[:defaultuser] = (0...16).map { o[rand(o.length)] }.join if
self[:defaultuser].to_s.strip.empty?
self[:username] = self[:defaultuser]
self[:name] = self[:defaultuser] if self[:name].to_s.strip.empty?
self[:secret] = (0...16).map { o[rand(o.length)] }.join if
self[:secret].to_s.strip.empty?
super
end
end
When creating new record getting that in logs, does anyone know why?
(I was entered 'abc' as name and 'aaaa' as defaultuser and expected to get
username matching with defaultuser)
12:56:33 api.1 | D, [2014-09-25T12:56:33.063887 #31856] DEBUG -- :
(0.000421s) INSERT INTO `cloud_pbx_sip_accounts` (`pbx_id`, `user_id`,
`name`, `defaultuser`, `created_at`, `updated_at`, `defaultuser`,
`username`, `name`, `secret`) VALUES (1, 1, 'abc', 'aaaa', '2014-09-25
12:56:33.062561', '2014-09-25 12:56:33.062561', 'JyRp2d2lCxUdgPwD',
'JyRp2d2lCxUdgPwD', 'JyRp2d2lCxUdgPwD', 'fJPuBCcvUb9PcyN9')
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.