A fake auction house I made for a school project.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
the_auctionhouse/src/func.rb

25 lines
553 B

3 years ago
def get_random_subtitle
subtitles = File.readlines "misc/subtitles.txt"
subtitles.sample.chomp
end
def init_info(*infos)
g = Hash.new ""
info = g.merge(*infos)
3 years ago
return info
end
def user
session[:userid] && User.find_by_id(session[:userid])
end
# Serve templates
def serve(template, info={})
# Insert the error info (if it exists)
error_info = session[:error_msg] != nil ? {error_msg: session[:error_msg]} : {}
session[:error_msg] = nil
# Serve the slim template
slim(template, locals: {info: init_info(info, error_info), user: user})
end