background preloader

Rails

Facebook Twitter

Css

Testing. Chart. Engine. Paperclip. Export. Activerecord. Passenger. Authorization. Pdf. Gist: 103748 - GitHub. Seejohnrun/database_validation - GitHub. Top 50 Ruby on Rails Websites. Twitter on Scala. Twitter on ScalaA Conversation with Steve Jenson, Alex Payne, and Robey Pointerby Bill VennersApril 3, 2009 Summary Three Twitter developers, Steve Jenson, Alex Payne, and Robey Pointer, talk with Bill Venners about their use of Scala in production at Twitter. Twitter is a fast growing website that provides a micro-blogging service. It began its life as a Ruby on Rails application, and still uses Ruby on Rails to deliver most user-facing web pages. But about a year ago they started replacing some of the back-end Ruby services with applications running on the JVM and written in Scala.

A quick look at Twitter Bill Venners: What is Twitter, and what in its technical history led you to consider Scala? Alex Payne: Twitter is a communications service that allows people to share information in 140 characters or less. One of the things that’s core to our business is providing open APIs for everything you can do on the website. Reliable, high performance code Complementing Ruby with Scala. Pogodan. Google Analytics and Rails in 60 Seconds | Ruby On Rails Blog. Spree - Open Source Commerce for Ruby on Rails. Understanding Ruby and Rails: Lazy load hooks – Simone Carletti's Blog. This article targets Rails 3 The article was written as of Rails 3.2. The information contained in this page might not apply to different versions. This is article is part of my series Understanding Ruby and Rails.

Please see the table of contents for the series to view the list of all posts. A small-but-interesting feature introduced in Rails 3 is the built-in support for lazy loading. Lazy loading is a very common design pattern. With Rails 3 you can now register specific hooks to be lazy-executed when the corresponding library is loaded. class ApplicationController < ActionController::Base initializer "active_record.include_plugins" do ActiveSupport.on_load(:active_record) do include MyApp::ActivePlugins end end end In this case we register the block to be executed when the ActiveRecord library is loaded.

ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base) This line of code executes all the hooks previously registered for ActiveRecord. lazy-load hooks in the wild Hook context. Sandrods's odf-report at master - GitHub. Hey, Don’t Dump. Debug! Are the "Two Ps" (print statements and prayer) all that comprise your debugging strategy? It's time you were introduced to the Interactive Ruby Debugger. I often ask other developers for advice. At times, the counsel reinforces my approach; at other times, the guidance challenges my thinking, leading me to refine my code or even pursue a wholly different solution.

Out of curiosity, I also ask other coders about debugging techniques, and more often than not, I am surprised by the answer. Believe it or not, the vast majority relies on liberal “print” statements sprinkled throughout code. Of course, “print” takes many forms—dump pertinent data structures, emit trace statements to standard error, and log interim results in a separate file—and there are cases where these methods are mandated. In my Rails work, I use the debugger extensively. Installing the Debugger The debugger, ruby-debug , is provided as a Ruby gem and installs just as easily as any other extension. $ ruby . ... Dcrec1's inploy at master - GitHub. UUID primary keys in Rails 3. Simple APIs using SerializeWithOptions | Viget Extend. While we were creating the SpeakerRate API, we noticed that ActiveRecord’s serialization system, while expressive, requires entirely too much repetition.

As an example, keeping a speaker’s email address out of an API response is simple enough: @speaker.to_xml(:except => :email) But if we want to include speaker information in a talk response, we have to exclude the email attribute again: Then imagine that a talk has a set of additional directives, and the API responses for events and series include lists of talks, and you can see how our implementation quickly turned into dozens of lines of repetitive code strewn across several controllers.

We figured there had to be a better way, so when we couldn't find one, we created SerializeWithOptions. At its core, SerializeWithOptions is a simple DSL for describing how to turn an ActiveRecord object into XML or JSON. With this configuration in place, calling @speaker.to_xml is the same as calling: Err.the_blog.find_by_title('Me and uFormats')

Agnostic roles in Rails.