25 April 2014

The Ruby Reflector

Topic

ActiveRecord

  Source Favicon
By Simon Taranto of Giant Robots Smashing Into Other Giant Robots 10 days ago.
Email

Frequently on projects we need to run a calculation through an ActiveRecord association. For example, we might want to get a user's all time purchases, a company's total amount of products sold, or in our case, the total amount of loans made to a campaign. This sort of calculation is ripe for using a map and an inject but frequently the solution is more elegant and faster if we can have SQL do the work instead.

Here is what our domain looks like. class Campaign < ActiveRecord::Base has_many :loans end

robots.thoughtbot.com Read
  Source Favicon
By Tony of Transcending Frontiers 1 month ago.
Email

…was iOS persistence is handle by Core Data therefore Core Data equals ActiveRecord. We keep pushing the point but it's not that Core Data isn 't ActiveRecord, its that things like persistence and what it means to each environment are very different.

4: IDE is not a bad word

Vim versus Emacs? How much finger twister can you play to do fairly amazing things with your editor? I've been sucked into this a few times over the years and will admit I find myself in the …

thefrontiergroup.com.au Read
  Source Favicon
By Mike Gunderloy of A Fresh Cup 1 month ago.
Email

Cequel - Ruby ORM for Cassandra.

AdequateRecord Pro: Like ActiveRecord, but more adequate - A preview of some speed improvements coming in Rails 4.2.

Introducing the Revamped Server UI - At Scout, that is.

Radiation-hardened Quine - A tour de force of useless ruby.

afreshcup.com Read
  Source Favicon
Email

If you're using #as_json to serialize your ActiveRecord models, it's possible your application is returning more than the client needs. To address this, consider using ActiveModel Serializers instead of #as_json .

The delivery of the response has unnecessary dependencies

Let's say your API has an endpoint the clients uses for reporting analytics events. Your controller might look something like this: class AnalyticsEventsController < ApiController def create …

robots.thoughtbot.com Read
  Source Favicon
By Mike Gunderloy of A Fresh Cup 3 months ago.
Email

Culling ActiveRecord Callbacks - How to simplify a tangled Rails codebase by switching to service objects (and speed up your tests as a bonus).

Examining Postgres 9.4 - A first look - What's coming down the pike next.

social_poster - gem for posting in social networks - Unified code for Facebook, Twitter, Livejournal, and VKontakte.

afreshcup.com Read
  Source Favicon
By Ignacio Huerta of Hobo Blog 3 months ago.
Email

ActiveRecord

Model.find(:all) is deprecated

finder.scoped :conditions => conditions has been replaced with finder.where(conditions)

raise_on_type_mismatch has been renamed to raise_on_type_mismatch!

Other

protected_attributes gem has been added to support the "old" way of protecting attributes

Domizio has made Hobo thread safe :)

Hobo's custom will_paginate has been packaged into the hobo_will_paginate gem. This should make possible to install Hobo without …

hobocentral.net Read
  Source Favicon
By sarah of the evolving ultrasaurus 3 months ago.
Email

I have no idea why ActiveRecord:: Base.establish connection is needed, but if we don't do that, then rake spec hangs after my first JS test with this ominous warning:

WARNING: there is already a transaction in progress

Perhaps someone reading this can explain this detail, but happy to have a configuration that works and hope this helps other folks who want fast tests that run reliably.

The post rspec: mixing transcations and truncation database clearner strategies appeared …

ultrasaurus.com Read
  Source Favicon
By Kurtz of Viget.com Blogs 3 months ago.
Email

POSTed via Mailgun webhooks. Special Delivery allows you to associate an ActiveRecord object to each outgoing email, which is accessible to the callback you execute in response to delivery events. Using these callbacks, your app can execute targeted responses simply and without the need for undesirable, one-off email parsing code.

Need to show an error message to a user who's recent job application email bounced? Easy. Want to email sad gifs to your marketing team whenever emails are …

viget.com Read
  Source Favicon
By Satish Talim of RubyLearning Blog 4 months ago.
Email

Simple CRUD app with ActiveRecord, SQLite3 and YAML

Using Rack Middleware

You can read through the RubyLearning FAQ .

Some Fun Apps

Here are some of the fun apps created by the previous batch participants and deployed to Heroku:

A static webpage .

Finding Photos on Flickr

String Reversal Service .

Stock Exchange Quote Service .

A Sinatra app to access GEO Info via GeoCoder

Sinatra Street View …

rubylearning.com Read
  Source Favicon
By David Eisinger of Viget.com Blogs 5 months ago.
Email

…combinations. The .as method defines the keys in the resulting output hash. Use names that match up with your ActiveRecord objects for great justice.

10: additional_degrees is just a blank line followed by another degree_group .

12: institution_name makes use of our line directive (which we'll discuss in a minute) and simply gives it a name.

14-18: Here's where a degree (e.g. " 1997; M.S.; Psychology") is defined. We use the year rule, defined on line 23 as four …

viget.com Read