Module: Extjs::ActsAsExtjs::InstanceMethods
- Defined in:
- lib/acts_as_extjs.rb
Instance Method Summary collapse
Instance Method Details
#extjs_error ⇒ Object
142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/acts_as_extjs.rb', line 142 def extjs_error error = self.errors.first if error.nil? nil else if error.last.at(0) == '^' error.last.slice(1..-1) else "#{self.class.human_attribute_name(error.first)} #{error.last}" end end end |
#extjs_errors ⇒ Object
155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/acts_as_extjs.rb', line 155 def extjs_errors hash = {} self.errors.each_pair do |field, error| error = error.first if error.at(0) == '^' = error.slice(1..-1) else = "#{self.class.human_attribute_name(field)} #{error}" end hash["#{self.class.name.downcase}[#{field}]"] = end hash end |