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
| t = Task.arel_table | |
| u = User.arel_table | |
| c = u.alias("creators") | |
| keyword = "%#{params}%" | |
| relation = joins("LEFT OUTER JOIN users ON users.id = tasks.user_assigned_id") | |
| .joins("LEFT OUTER JOIN users as #{c.name} ON #{c.name}.id = tasks.creator_id") | |
| .where( | |
| t[:id].matches(keyword) |
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
| t = Task.arel_table | |
| u = User.arel_table | |
| c = u.alias("creators_tasks") | |
| keyword = "%#{params}%" | |
| relation = includes(:user_assigned,:creator) | |
| .where( | |
| t[:id].matches(keyword) | |
| .or(u[:username].matches(keyword)) |
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
| class SimpleRackApp | |
| def call(env) | |
| [200, {'Content-Type' => 'text/plain'}, ["Hello World!"]] | |
| end | |
| end | |
| run SimpleRackApp.new |
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
| class SimpleRackApp | |
| def call(env) | |
| [200, {}, ["Hello World!"]] | |
| end | |
| end | |
| use Rack::ContentType, 'text/plain' # Adds the Rack::ContentLength middleware in the application middleware stack | |
| run SimpleRackApp.new # Specifies the main rack application to run |
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
| class App1 | |
| def call(env) | |
| [200, {}, ['App 1']] | |
| end | |
| end | |
| class App2 | |
| def call(env) | |
| [200, {}, ['App 2']] | |
| 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
| $ rake middleware | |
| use ActionDispatch::Static | |
| use Rack::Lock | |
| use ActiveSupport::Cache::Strategy::LocalCache | |
| use Rack::Runtime | |
| use Rails::Rack::Logger | |
| use ActionDispatch::ShowExceptions | |
| use ActionDispatch::RemoteIp | |
| use Rack::Sendfile | |
| use ActionDispatch::Callbacks |
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
| # customers_controller | |
| def index | |
| index! do |format| | |
| format.html | |
| format.js do | |
| @customers = Customer.data_table(params) | |
| @iTotalRecords = Customer.count | |
| @iTotalDisplayRecords = @customers.length | |
| @sEcho = params[:sEcho].to_i |
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
| <a href="javascript: void(0)" onclick="popup('<%= ticket_manager_request_url(:id=>@request.request_no) %>')"> | |
| Print Service Request Ticket | |
| </a> | |
| <script type="text/javascript"> | |
| <!-- | |
| function popup(url) | |
| { | |
| var width = 900; | |
| var height = 500; |
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
| If repeating "FactoryGirl" is too verbose for you, you can mix the syntax methods in: | |
| # rspec | |
| RSpec.configure do |config| | |
| config.include FactoryGirl::Syntax::Methods | |
| end | |
| # Test::Unit | |
| class Test::Unit::TestCase | |
| include FactoryGirl::Syntax::Methods |
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
| 1) Setup Homebrew: | |
| ruby <(curl -fsSk https://raw.github.com/mxcl/homebrew/go) | |
| 2) Make sure Xcode Command Line Tools Package is installed: | |
| https://developer.apple.com/downloads/index.action | |
| 3) brew install wget | |
| 4) brew install git |