Adds default values to limits when the db does not have them
This prevents errors when doing rake db:setup (the db has still not been created but the rails models are loaded)
This commit is contained in:
@@ -147,7 +147,7 @@ class Debate < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def self.title_max_length
|
||||
@@title_max_length ||= self.columns.find { |c| c.name == 'title' }.limit
|
||||
@@title_max_length ||= self.columns.find { |c| c.name == 'title' }.limit || 80
|
||||
end
|
||||
|
||||
def self.description_max_length
|
||||
|
||||
@@ -34,7 +34,7 @@ class Organization < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def self.name_max_length
|
||||
@@name_max_length ||= self.columns.find { |c| c.name == 'name' }.limit
|
||||
@@name_max_length ||= self.columns.find { |c| c.name == 'name' }.limit || 60
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -144,7 +144,7 @@ class User < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def self.username_max_length
|
||||
@@username_max_length ||= self.columns.find { |c| c.name == 'username' }.limit
|
||||
@@username_max_length ||= self.columns.find { |c| c.name == 'username' }.limit || 60
|
||||
end
|
||||
|
||||
def show_welcome_screen?
|
||||
|
||||
Reference in New Issue
Block a user