This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'builder' | |
class Sitemap | |
STATIC_URLS = ['/home/about', | |
'/home/help', | |
'/home/contact_us', | |
'/home/terms'] | |
class << self |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Saas/controllers/saas/sessions_controller.rb | |
module Saas | |
class SessionsController < ApplicationController | |
def new | |
render :text => 'Hi from SessionsController' | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Saas/config/engine.rb | |
module Saas | |
class Engine < Rails::Engine | |
engine_name :saas | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Saas/lib/saas.rb | |
module Saas | |
require File.expand_path('../../config/engine', __FILE__) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MyApp/lib/saas/config/routes.rb | |
Rails::Application.routes.draw do |map| | |
namespace :saas do | |
resources :sessions | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'saas', :require => 'saas', :path => 'lib/saas' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gem::Specification.new do |s| | |
s.platform = Gem::Platform::RUBY | |
s.name = 'saas' | |
s.version = '0.1' | |
s.description = 'A generic modular application.' | |
s.required_ruby_version = '>= 1.8.7' | |
s.author = 'Anup Narkhede' | |
s.require_path = 'lib' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pretty commified numbers | |
module ApplicationHelper | |
def format_num(num, delim = ',') | |
number_with_precision(num, :precision => 2, :separator => '.', :delimiter => ',') | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To fix unicode character errors in mysql | |
# => Put this file in lib and require it in environment.rb | |
require 'mysql' | |
class Mysql::Result | |
def encode(value, encoding = "utf-8") | |
String === value ? value.force_encoding(encoding) : value | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Which folder is eating up the space? | |
du -s * | sort -n |
OlderNewer