Different services I can suggest when a non-tech friend or family member asks me how they can cheaply make a website and possibly use it to sell stuff online.
Website Hosting
# MODEL | |
class Theater | |
named_scope :with_recent_comments, | |
:select => "*, recent_comments.created_at AS last_comment_at", | |
:joins => "INNER JOIN (SELECT id, entity_id, created_at FROM comments WHERE entity_type = 'Theater' ORDER by id DESC LIMIT 100) | |
AS recent_comments ON recent_comments.entity_id = theaters.id", | |
:order => "recent_comments.created_at DESC" | |
end |
# MODEL | |
class Theater | |
named_scope :with_recent_comments, | |
:select => "*, recent_comments.created_at AS last_comment_at", | |
:joins => "INNER JOIN (SELECT id, entity_id, created_at FROM comments WHERE entity_type = 'Theater' LIMIT 100) | |
AS recent_comments ON recent_comments.entity_id = theaters.id", | |
:order => "recent_comments.created_at DESC" | |
end |
Different services I can suggest when a non-tech friend or family member asks me how they can cheaply make a website and possibly use it to sell stuff online.
Website Hosting
# If you ever needed an array of all ActiveRecord models in your Rails app (+ Session): | |
Dir["app/models/**/*.rb"].each {|r| require r} | |
subclasses_of(ActiveRecord::Base).map(&:class_name) | |
# Or *all* models: | |
ActiveRecord::Base.connection # Preloads driver constants | |
constants_before = Object.constants | |
Dir["app/models/**/*.rb"].each {|r| require r} | |
Object.constants - constants_before |
############################################################# | |
# Application | |
############################################################# | |
set :application, "" #your app's name here | |
set :server_ip, "" #your server's ip here | |
set :deploy_to, "/home/rails/#{application}" #the path to your rails app here | |
############################################################# | |
# Servers |