- 1
<%= !!@case[:img] ? image_tag(@case[:img]) : "" %>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−104
<%= !!@case[:img] ? image_tag(@case[:img]) : "" %>
−99
<%= @album.playlist.gsub('
','<br />') %>
Тогда, видимо, не догадался написать "\n" :)
−99
respond_with_error("Lat can't be blank.", :unprocessable_entity) and return if params[:lat].blank?
respond_with_error("Lon can't be blank.", :unprocessable_entity) and return if params[:lon].blank?
respond_with_error("Lat is not a number.", :unprocessable_entity) and return if !is_float?(params[:lat])
respond_with_error("Lon is not a number.", :unprocessable_entity) and return if !is_float?(params[:lon])
индусский кот от Фет Фрумоса
−95
def space(n)
str = ''
n.times do
str += ' '
end
str
end
−106
def parse_response(object)
return Hashie::Mash.new(JSON.parse(object))
rescue => e
#should handle here different error types/levels or else throw the exceptions to the upper layer (client)
if e.is_a?(JSON::ParserError) && e.message =~ /<html>/
raise "Invalid response from Platform server - #{self.class.parse_json_error(response.body)}"
else
raise e
end
end
−110
def parse_time(input, minutes = false)
TimeParser.parse_time(current_user, input, minutes)
end
−105
def index
list
render :action => 'list'
end
def list
end
−102
Task.joins(:owners).where(:users => {:id => current_user}).order("tasks.weight DESC").limit(1).first
−102
def route_match? origin, destination
origin.iata == origin and destination.iata == destination
end
В классе конечно определены методы origin и destination
−100
File.basename(File.basename(name, '.jpg'), '.png')
Файл либо с расширением .png, либо .jpg