Multiplos semestres
This commit is contained in:
@@ -6,6 +6,8 @@ App.webmaster_email = "webmaster@wikiufc.gelsol.org"
|
||||
App.default_host = "wikiufc.gelsol.org"
|
||||
App.base_path = ""
|
||||
|
||||
App.current_period = "2008.1"
|
||||
|
||||
# Limites
|
||||
App.max_upload_file_size = 5.megabytes
|
||||
|
||||
|
||||
@@ -8,3 +8,19 @@ class String
|
||||
Float self rescue false
|
||||
end
|
||||
end
|
||||
|
||||
class Array
|
||||
def add_condition! (condition, conjunction = 'AND')
|
||||
if String === condition
|
||||
add_condition!([condition])
|
||||
elsif Hash === condition
|
||||
add_condition!([condition.keys.map { |attr| "#{attr}=?" }.join(' AND ')] + condition.values)
|
||||
elsif Array === condition
|
||||
self[0] = "(#{self[0]}) #{conjunction} (#{condition.shift})" unless empty?
|
||||
(self << condition).flatten!
|
||||
else
|
||||
raise "don't know how to handle this condition type"
|
||||
end
|
||||
self
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user