forked from fixin.me/fixin.me
		
	Merging from main master to my repo master. #4
@ -10,8 +10,8 @@ class Unit < ApplicationRecord
 | 
				
			|||||||
    errors.add(:base, :multilevel_nesting) if base.base.present?
 | 
					    errors.add(:base, :multilevel_nesting) if base.base.present?
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  validates :symbol, presence: true, uniqueness: {scope: :user_id},
 | 
					  validates :symbol, presence: true, uniqueness: {scope: :user_id},
 | 
				
			||||||
    length: {maximum: columns_hash['symbol'].limit}
 | 
					    length: {maximum: type_for_attribute(:symbol).limit}
 | 
				
			||||||
  validates :description, length: {maximum: columns_hash['description'].limit}
 | 
					  validates :description, length: {maximum: type_for_attribute(:description).limit}
 | 
				
			||||||
  validates :multiplier, numericality: {equal_to: 1}, unless: :base
 | 
					  validates :multiplier, numericality: {equal_to: 1}, unless: :base
 | 
				
			||||||
  validates :multiplier, numericality: {other_than: 0, precision: true, scale: true}, if: :base
 | 
					  validates :multiplier, numericality: {other_than: 0, precision: true, scale: true}, if: :base
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -14,8 +14,8 @@ class User < ApplicationRecord
 | 
				
			|||||||
  has_many :units, dependent: :destroy
 | 
					  has_many :units, dependent: :destroy
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  validates :email, presence: true, uniqueness: true,
 | 
					  validates :email, presence: true, uniqueness: true,
 | 
				
			||||||
    length: {maximum: columns_hash['email'].limit}
 | 
					    length: {maximum: type_for_attribute(:email).limit}
 | 
				
			||||||
  validates :unconfirmed_email, length: {maximum: columns_hash['unconfirmed_email'].limit}
 | 
					  validates :unconfirmed_email, length: {maximum: type_for_attribute(:unconfirmed_email).limit}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def to_s
 | 
					  def to_s
 | 
				
			||||||
    email
 | 
					    email
 | 
				
			||||||
 | 
				
			|||||||
@ -4,11 +4,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    <td class="<%= class_names({subunit: @unit.base}) %>">
 | 
					    <td class="<%= class_names({subunit: @unit.base}) %>">
 | 
				
			||||||
      <%= form.text_field :symbol, form: :unit_form, required: true, autofocus: true, size: 12,
 | 
					      <%= form.text_field :symbol, form: :unit_form, required: true, autofocus: true, size: 12,
 | 
				
			||||||
        maxlength: @unit.class.columns_hash['symbol'].limit, autocomplete: "off" %>
 | 
					        maxlength: @unit.class.type_for_attribute(:symbol).limit, autocomplete: "off" %>
 | 
				
			||||||
    </td>
 | 
					    </td>
 | 
				
			||||||
    <td>
 | 
					    <td>
 | 
				
			||||||
      <%= form.text_area :description, form: :unit_form, cols: 30, rows: 1, escape: false,
 | 
					      <%= form.text_area :description, form: :unit_form, cols: 30, rows: 1, escape: false,
 | 
				
			||||||
        maxlength: @unit.class.columns_hash['description'].limit, autocomplete: "off" %>
 | 
					        maxlength: @unit.class.type_for_attribute(:description).limit, autocomplete: "off" %>
 | 
				
			||||||
    </td>
 | 
					    </td>
 | 
				
			||||||
    <td>
 | 
					    <td>
 | 
				
			||||||
      <% unless @unit.base.nil? %>
 | 
					      <% unless @unit.base.nil? %>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user