Skip to content

Instantly share code, notes, and snippets.

View victorlhlam's full-sized avatar

Victor Lam victorlhlam

View GitHub Profile
#routes.rb
get "blog/category/:category/" => "posts#by_category", as: :post_category
get "blog/category/:category/index.html" => "posts#by_category"
get "blog/page-:page/" => "posts#index", as: :blog
get "blog/page-:page/index.html" => "posts#index"
get "blog/:slug/" => "posts#by_slug", as: :post_slug
get "blog/:slug/index.html" => "posts#by_slug"
get "blog" => "posts#index", as: :blog
get "blog/index.html" => "posts#index"
# define a method to run rake tasks
def run_rake(task, options={}, &block)
rake = fetch(:rake, 'rake')
rails_env = fetch(:rails_env, 'production')
command = "cd #{current_path} && #{rake} #{task} RAILS_ENV=#{rails_env}"
run(command, options, &block)
end