forked from fixin.me/fixin.me
Compare commits
1 Commits
fix-text-c
...
fix-sqlite
| Author | SHA1 | Date | |
|---|---|---|---|
| 8be9b3eb2f |
@@ -16,7 +16,7 @@ class Quantity < ApplicationRecord
|
||||
end
|
||||
validates :name, presence: true, uniqueness: {scope: [:user_id, :parent_id]},
|
||||
length: {maximum: type_for_attribute(:name).limit}
|
||||
validates :description, length: {maximum: type_for_attribute(:description).limit} if type_for_attribute(:description).limit
|
||||
validates :description, length: {maximum: type_for_attribute(:description).limit}
|
||||
|
||||
# Update :depths of progenies after parent change
|
||||
before_save if: :parent_changed? do
|
||||
@@ -66,7 +66,7 @@ class Quantity < ApplicationRecord
|
||||
self.model.with(numbered: numbered(:parent_id, :name)).with_recursive(arel_table.name => [
|
||||
numbered.project(
|
||||
numbered[Arel.star],
|
||||
numbered.cast(numbered[:child_number], 'BINARY').as('path')
|
||||
numbered.cast(numbered[:child_number], connection.adapter_name == 'Mysql2' ? 'BINARY' : 'BLOB').as('path')
|
||||
).where(numbered[root && include_root ? :id : :parent_id].eq(root)),
|
||||
numbered.project(
|
||||
numbered[Arel.star],
|
||||
|
||||
@@ -13,7 +13,7 @@ class Unit < ApplicationRecord
|
||||
end
|
||||
validates :symbol, presence: true, uniqueness: {scope: :user_id},
|
||||
length: {maximum: type_for_attribute(:symbol).limit}
|
||||
validates :description, length: {maximum: type_for_attribute(:description).limit} if type_for_attribute(:description).limit
|
||||
validates :description, length: {maximum: type_for_attribute(:description).limit}
|
||||
validates :multiplier, numericality: {equal_to: 1}, unless: :base
|
||||
validates :multiplier, numericality: {greater_than: 0, precision: true, scale: true}, if: :base
|
||||
|
||||
|
||||
Reference in New Issue
Block a user