Erlingur Þorsteinsson
Erlingur Þorsteinsson
So I figured out that if I remove the `attribute :average_weight, :float, default: 1` line from the supply model it works correctly. So this is maybe a Rails 5 attributes...
Yeah. The interesting thing is that if I change the attribute line from float to decimal, i.e. `attribute :average_weight, :decimal, default: 1` I get a tiny_tds errror: ``` TinyTds::Error: Error...
I wonder why when I have a `decimal` attribute it get's converted to an `nvarchar`. Surely it shouldn't do that, right? I think I have to just attach a debugger...
So when I have the line `attribute :average_weight, :decimal` in the model, the type of the attribute is set as `ActiveModel::Type::Decimal` which does not respond to the `sqlserver_type` method and...
Yeah, looks like you're right. So I guess the attributes API is incompatible with SQL server adapter?
I've created an initializer `rails_sqlserver_types.rb` that does: ``` ActiveRecord::Type.register(:sqls_decimal, ActiveRecord::Type::SQLServer::Decimal) ActiveRecord::Type.register(:sqls_float, ActiveRecord::Type::SQLServer::Float ``` (I've not given the names of the types any thought, I'll think of better ones :)) Then,...
If I use Decimal both precision and scale are `nil` here: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/ed8b1700e4404a529b59f55d6bd76397ee9df737/lib/active_record/connection_adapters/sqlserver/type/decimal.rb#L9
@ab320012 I added ``` private ActiveRecord::Type.register(:decimal, ActiveRecord::Type::SQLServer::Decimal, adapter: :sqlserver) ``` To the bottom of `sqlserver_adapter.rb` like the Postgres adapter does and it *works*. Haven't run any tests or anything but...
Any thoughts on this issue @metaskills? I could also send in a PR with this if you are interested? Would be nice to be compatible with the new attributes API...
:+1: Same here. No way to set this up on 14.04?