NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
| // example of parallelism | |
| package main | |
| import ( | |
| "flag" | |
| "fmt" | |
| "io" | |
| "os" | |
| "sync" | |
| "time" |
NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
| Here is a list of scopes to use in Sublime Text 2 snippets - | |
| ActionScript: source.actionscript.2 | |
| AppleScript: source.applescript | |
| ASP: source.asp | |
| Batch FIle: source.dosbatch | |
| C#: source.cs | |
| C++: source.c++ | |
| Clojure: source.clojure | |
| CoffeeScript: source.coffee |
| class ApiLogger < Grape::Middleware::Base | |
| def before | |
| Rails.logger.info "[api] Requested: #{request_log_data.to_json}\n" + | |
| "[api] #{response_log_data[:description]} #{response_log_data[:source_file]}:#{response_log_data[:source_line]}" | |
| end | |
| private | |
| def request_log_data |
| # yes, sometimes you need to do this. you get pilloried in a forum if you | |
| # ask about it, though! | |
| # this code taken from | |
| # http://wholemeal.co.nz/blog/2011/04/05/rendering-from-a-model-in-rails-3/ | |
| class MyModel < ActiveRecord::Base | |
| # Use the my_models/_my_model.txt.erb view to render this object as a string | |
| def to_s | |
| ActionView::Base.new(Rails.configuration.paths.app.views.first).render( |
| /** | |
| * converted stringify() to jQuery plugin. | |
| * serializes a simple object to a JSON formatted string. | |
| * Note: stringify() is different from jQuery.serialize() which URLEncodes form elements | |
| * UPDATES: | |
| * Added a fix to skip over Object.prototype members added by the prototype.js library | |
| * USAGE: | |
| * jQuery.ajax({ |