My mistake: errors is used also in activerecord, so it tires to clear my
object errors instead of ActiveRecord::errors !

2009/3/10 Sylvain <[email protected]>

> Hi all,
> In my model, I have a string named error_flags which has the raisen
> error codes of the object.
> It's "0" if no error codes and for example "0,7,9" if the error of
> type 7 and 9 are raisen. It's kind of useless for the end user if I
> leave it like that.
> So, I've created an inline values named errors which give a String
> calculated according to the values:
>
> def errors
> error = ""
> #code for grabing the errors and putting them in the string
> return error
> end
>
> When I try to create the Object (I retrieve the values from an XML
> file), I've got this error:
> undefined method `clear' for "Le chemin est OK":String ("Le chemin est
> OK" is the default string for the errors (if error_flag == 0))
>
> I thought that these inline values were created "on the fly" so I'm a
> bit confused here. Whre's my mistake?
>
> Thanks in advance
>
> Here's the trace
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/
> lib/active_record/validations.rb:1027:in `valid?'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/
> lib/active_record/callbacks.rb:286:in `valid_with_callbacks?'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/
> lib/active_record/validations.rb:1008:in `save_with_validation'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/
> lib/active_record/dirty.rb:79:in `save_with_dirty'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/
> lib/active_record/transactions.rb:179:in
> `with_transaction_returning_status'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/
> lib/active_record/connection_adapters/abstract/database_statements.rb:
> 66:in `transaction'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/
> lib/active_record/transactions.rb:129:in `transaction'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/
> lib/active_record/transactions.rb:138:in `transaction'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/
> lib/active_record/transactions.rb:178:in
> `with_transaction_returning_status'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/
> lib/active_record/transactions.rb:146:in `save_with_transactions'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/
> lib/active_record/transactions.rb:158:in
> `rollback_active_record_state!'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/
> lib/active_record/transactions.rb:146:in `save_with_transactions'
> vendor/plugins/active_scaffold/lib/extensions/unsaved_record.rb:15:in
> `save_with_unsaved_flag'
> app/controllers/aspen_topo_files_controller.rb:1474:in `create'
> app/controllers/aspen_topo_files_controller.rb:1292:in `each'
> app/controllers/aspen_topo_files_controller.rb:1292:in `create'
> app/controllers/aspen_topo_files_controller.rb:1288:in `each'
> app/controllers/aspen_topo_files_controller.rb:1288:in `create'
> app/controllers/aspen_topo_files_controller.rb:1278:in `each'
> app/controllers/aspen_topo_files_controller.rb:1278:in `create'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/mime_responds.rb:106:in `call'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/mime_responds.rb:106:in `respond_to'
> app/controllers/aspen_topo_files_controller.rb:88:in `create'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/base.rb:1253:in `perform_action'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/filters.rb:617:in `call_filters'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/filters.rb:610:in `perform_action_with_filters'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/benchmarking.rb:68:in
> `perform_action_with_benchmark'
> /home/sylvain/jruby-1.1.6/lib/ruby/1.8/benchmark.rb:293:in `measure'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/benchmarking.rb:68:in
> `perform_action_with_benchmark'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/rescue.rb:136:in `perform_action_with_rescue'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/caching/sql_cache.rb:13:in
> `perform_action_with_caching'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/
> lib/active_record/connection_adapters/abstract/query_cache.rb:34:in
> `cache'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/activerecord-2.2.2/
> lib/active_record/query_cache.rb:8:in `cache'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/caching/sql_cache.rb:12:in
> `perform_action_with_caching'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/base.rb:524:in `process'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/filters.rb:606:in `process_with_filters'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/session_management.rb:134:in
> `process_with_session_management_support'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/base.rb:392:in `process'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/dispatcher.rb:183:in `handle_request'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/dispatcher.rb:110:in `dispatch_unlocked'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/dispatcher.rb:123:in `dispatch'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/dispatcher.rb:122:in `dispatch'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/dispatcher.rb:132:in `dispatch_cgi'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
> action_controller/dispatcher.rb:39:in `dispatch'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/
> webrick_server.rb:103:in `handle_dispatch'
> /home/sylvain/jruby-1.1.6/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/
> webrick_server.rb:74:in `service'
> /home/sylvain/jruby-1.1.6/lib/ruby/1.8/webrick/httpserver.rb:104:in
> `service'
> /home/sylvain/jruby-1.1.6/lib/ruby/1.8/webrick/httpserver.rb:65:in
> `run'
> /home/sylvain/jruby-1.1.6/lib/ruby/1.8/webrick/server.rb:173:in
> `start_thread'
> :1:in `start'

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to