On Apr 1, 4:46 pm, "Rick F." <[email protected]> wrote:
> Hi all,
>
> Running Rails: 2.3.5
> Ruby: 1.8.7p302
> Firebird: 2.1
>
> I am running into a weird issue. When connecting to a firebird database
> I get the following on any model that uses "validates_uniqueness_of".
> Other validations work fine. The unique check is simply on a name field.
> I should add this code works fine with Postgres...no issues. Access to
> all tables for reads / writes without the unique validation works
> without issue on the Firebird database.
>
> These models worked without issue on earlier versions of ruby 1.8.6 and
> rails 2.1.1 AND firebird.
>
> Can anyone point me in a direction to better understand what is going on
> here?
>
> Does the Firbird DB need to be Multibyte as well? Is there anyway to
> prevent using multibyte?
>
ActiveSupport adds somestuff to strings to allow utf8 strings to be
operated on safely (eg truncation etc) and to provide various unicodey
utilities. various operations (like some_string.mb_chars.reverse) will
return a MultiByte::Chars object, but this is supposed to be done in a
way that it still looks like the string the chars object is wrapping.
In your particular case this isn't happening - while building that
string instead of just using the wrapper string (Testname) it's
serializing the whole MB::Chars object which is wrong. Don't know why
it's happening though
Fred
> ActiveRecord::StatementInvalid in RoleController#create
>
> RangeError: VARCHAR overflow: 72 bytes exceeds 64 byte(s) allowed.:
> SELECT FIRST 1 "OC_USER_ROLE".id FROM "OC_USER_ROLE" WHERE
> ("OC_USER_ROLE"."NAME" = ?) , ---
> !ruby/object:ActiveSupport::Multibyte::Chars
> wrapped_string: Testname
>
> RAILS_ROOT: D:/4.3Branch/webui
> Application Trace | Framework Trace | Full Trace
>
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/connection_a
> dapters/abstract_adapter.rb:219:in
> `log'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/connection_a
> dapters/fb_adapter.rb:306:in
> `log'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/connection_a
> dapters/fb_adapter.rb:311:in
> `select_all'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/connection_a
> dapters/fb_adapter.rb:294:in
> `translate'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/connection_a
> dapters/fb_adapter.rb:310:in
> `select_all'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/base.rb:665: in
> `find_by_sql'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/base.rb:1556
> :in
> `find_every'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/base.rb:1513
> :in
> `find_initial'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/base.rb:700: in
> `exists?'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/validations.
> rb:827:in
> `validates_uniqueness_of'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/base.rb:2151
> :in
> `with_scope'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/base.rb:2159
> :in
> `with_exclusive_scope'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/validations.
> rb:826:in
> `validates_uniqueness_of'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/validations.
> rb:468:in
> `validates_each'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/validations.
> rb:465:in
> `each'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/validations.
> rb:465:in
> `validates_each'
> D:/4.3Branch/webui/vendor/rails/activesupport/lib/active_support/callbacks.
> rb:182:in
> `call'
> D:/4.3Branch/webui/vendor/rails/activesupport/lib/active_support/callbacks.
> rb:182:in
> `evaluate_method'
> D:/4.3Branch/webui/vendor/rails/activesupport/lib/active_support/callbacks.
> rb:166:in
> `call'
> D:/4.3Branch/webui/vendor/rails/activesupport/lib/active_support/callbacks.
> rb:90:in
> `run'
> D:/4.3Branch/webui/vendor/rails/activesupport/lib/active_support/callbacks.
> rb:90:in
> `each'
> D:/4.3Branch/webui/vendor/rails/activesupport/lib/active_support/callbacks.
> rb:90:in
> `send'
> D:/4.3Branch/webui/vendor/rails/activesupport/lib/active_support/callbacks.
> rb:90:in
> `run'
> D:/4.3Branch/webui/vendor/rails/activesupport/lib/active_support/callbacks.
> rb:276:in
> `run_callbacks'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/validations.
> rb:1098:in
> `valid_without_callbacks?'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/callbacks.rb
> :315:in
> `valid?'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/validations.
> rb:1077:in
> `save_without_dirty'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/dirty.rb:79: in
> `save_without_transactions'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/transactions
> .rb:229:in
> `send'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/transactions
> .rb:229:in
> `with_transaction_returning_status'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/connection_a
> dapters/abstract/database_statements.rb:136:in
> `transaction'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/transactions
> .rb:182:in
> `transaction'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/transactions
> .rb:228:in
> `with_transaction_returning_status'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/transactions
> .rb:196:in
> `save'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/transactions
> .rb:208:in
> `rollback_active_record_state!'
> D:/4.3Branch/webui/vendor/rails/activerecord/lib/active_record/transactions
> .rb:196:in
> `save'
> D:/4.3Branch/webui/app/controllers/role_controller.rb:278:in `create'
>
> --
> Posted viahttp://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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/rubyonrails-talk?hl=en.