-
Type: Task
-
Resolution: Won't Fix
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
I have a model
Unable to find source-code formatter for language: `. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
ruby # encoding: utf-8 module Trst class Firm include Mongoid::Document include Mongoid::Timestamps include ViewHelpers field :name, type: Array, default: ['ShortName','FullName','OfficialName'] field :identities, type: Hash, default: {"caen" => "xxx", "chambcom" => "J", "fiscal" => "RO", "account" => "xxx", "itm" => "xxx", "internet" => "xxx.xxx.xxx.xxx", "cod" => "XXX"} field :contact, type: Hash, default: {"phone" => "xxxx", "fax" => "xxx", "email" => "xx@xxx.xxx", "website" => "xxxx"} field :about, type: Hash, default: {"scope" => "Scope ...?...", "descript" => "Descript ...?..."} validate :identities_fiscal_uniq # @todo def view_filter [id, name[1]] end protected # @todo def identities_fiscal_uniq return if !identities.key?('fiscal') if self.class.where(:'identities.fiscal' => identities['fiscal']) && new_record? self.errors.add(:'identities.fiscal', :taken) end end end # Firm end # Trst
`
on duplicates I get NoMethodError - undefined method identities.fiscal' for ...
Same error if I use
Unable to find source-code formatter for language: `ruby. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
validates_uniqueness_of :'identities.fiscal', :case_sensitive => false
`
In console
Unable to find source-code formatter for language: `ruby. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
f = Trst::Firm.first => #<Wstm::PartnerFirm _id: 4e07751d81cb1542ca000001, created_at: 2012-11-04 07:41:01 UTC, updated_at: 2013-01-26 18:28:28 UTC, name: ["Diren", "Diren Exim", "S.C. Diren Exim S.R.L."], identities: {"caen"="xxx", "chambcom"="J12/1000/2000", "fiscal"="RO13354034", "account"="DIR", "itm"="23385-12898/09.04.2004", "internet"="xxx.xxx.xxx.xxx", "cod"="DIR"}, contact: {"phone"="0364-410142", "fax"="0364-410142", "email"="office@diren-reciclare.ro", "website"=>"diren-reciclare.ro"}, about: {"scope"=>"Scope ...?...", "descript"=>"Descript ...?..."}, type: "Wstm::PartnerFirm", client: true, supplr: true, transp: true, p03: false, firm: true, name[1]: "Diren Exim" ruby-2.1.1 > f.errors.add(:'identities.fiscal',:taken) NoMethodError: undefined method `identities.fiscal' for #<Wstm::PartnerFirm:0x00000005994f58> from /home/kfl62/work/trst_sys_sinatra/.bundle/ruby/2.1.0/gems/mongoid-3.1.6/lib/mongoid/attributes.rb:320:in `method_missing' from /home/kfl62/work/trst_sys_sinatra/.bundle/ruby/2.1.0/gems/mongoid-3.1.6/lib/mongoid/validations.rb:66:in `read_attribute_for_validation' ...
`
I forget to mention Wstm::ParterFirm < Trst::Firm