recentpopularlog in

edavey : rails   135

« earlier  
Skylight | Pricing
Skylight visualizes all your app’s performance data in a way that makes it easy to understand and act on.
rails  profiling 
december 2018 by edavey
Rails Database Best Practices
Working on an oldish Rails project, I came across some smelly ActiveRecord code that begged for some refactoring love. I also spent some time speeding up pages with slow/many database calls. Between those two experiences, I felt the inspiration to write-up some “Back to Basics” Rails Database Best Practices.
rails  postgres  database 
november 2016 by edavey
thredded/thredded: The best Rails forums engine ever.
Thredded is a Rails 4.2+ forum/messageboard engine. Its goal is to be as simple and feature rich as possible.

Some of the features currently in Thredded:

Markdown post formatting with some BBCode support (by default).
(Un)read posts tracking.
Email notifications, topic subscriptions, @-mentions, per-messageboard notification settings.
Private group messaging.
Full-text search using the database.
Pinned and locked topics.
List of currently online users, for all forums and per-messageboard.
Flexible permissions system.
Basic moderation.
Lightweight default theme configurable via Sass.
blog  ruby  rails 
june 2016 by edavey
thoughtbot/scenic: Versioned database views for Rails
Scenic adds methods to ActiveRecord::Migration to create and manage database views in Rails.

Using Scenic, you can bring the power of SQL views to your Rails application without having to switch your schema format to SQL. Scenic provides a convention for versioning views that keeps your migration history consistent and reversible and avoids having to duplicate SQL strings across migrations. As an added bonus, you define the structure of your view in a SQL file, meaning you get full SQL syntax highlighting in the editor of your choice and can easily test your SQL in the database console during development.

Scenic ships with support for PostgreSQL. The adapter is configurable (see Scenic::Configuration) and has a minimal interface (see Scenic::Adapters::Postgres) that other gems can provide.
view  database  rails 
january 2016 by edavey
.:: Phrack Magazine: attacking rails apps ::.
This little article aims to give an introduction to the topic of attacking
Ruby on Rails applications. It's neither complete nor dropping 0day. It's
rather the authors attempt to accumulate the interesting attack paths and
techniques in one write up. As yours truly spend most of his work on Ruby
on Rails applications in the time when Rails version 3 was current, some of
the described techniques are not applicable to Rails 4 any more. However
there is still a broad attack surface of older applications as migrating
Rails code up one or two version appears to be a real pain in the ass for
lager projects (if you doubt this ask your local Rails startup peeps :)
rails  ruby  security 
october 2015 by edavey
Faking APIs in Development and Staging
Capybara Discoball is a gem that allows you to boot other Rack apps in the background of a feature test run. Once you have an app running, the adapter can be pointed to that app.

You decide to use Capybara Discoball because we don’t need to stub anything. The application is literally making HTTP requests to APIs that are running on your localhost.
capybara  rails  testing  api 
july 2015 by edavey
Rails Multi-Database Best Practices Roundup - CustomInk Technology Blog
most Rails applications I have worked with have managed two or more database connections. Often times these connections are both readable and writable. Collectively they represent a comprehensive business domain. Today I would like to cover everything I know about this topic, without going into the bike shed of micro services or schema management gems.
database  rails 
june 2015 by edavey
Lograge is an attempt to bring sanity to Rails' noisy and unusable, unparsable and, in the context of running multiple processes and servers, unreadable default logging output. Rails' default approach to log everything is great during development, it's terrible when running it in production. It pretty much renders Rails logs useless to me.
rails  logging 
june 2015 by edavey
Testing async emails, the Rails 4.2+ way
Say you're building an app that needs to send emails. We all agree that we should never block the controller, so async delivery is the way to go. To achieve this, we'll move our email sending code outside the original request/response cycle with the help of an asynchronous processing library that can handle jobs in the background.
testing  rails  async 
may 2015 by edavey
Using Null Objects can make life a lot easier and avoid having excessive nil? checks. Avdi Grimm made an excellent library called Naught which makes working with and building Null Objects easier.
ruby  rails  null_object 
april 2015 by edavey
react-rails is a ruby gem which makes it easier to use React and JSX in your Ruby on Rails application.

Making it easy to include react.js as part of your dependencies in application.js.
Transforming JSX into regular JS on request, or as part of asset precompilation.
View helpers to render React components in an unobtrusive style and/or on the server.
react  rails 
march 2015 by edavey
Databound provides Javascript a simple API to the Ruby on Rails CRUD.
api  javascript  rails 
january 2015 by edavey
Rails Engine Design Patterns: Real World Examples | Toptal
Why are Rails Engines not used more often? I don’t know the answer, but I do think that the generalization of “Everything is an Engine” has hidden the problem domains that they can help to solve.
december 2014 by edavey
Simple, declarative, role-based access control system for Rails and Ruby
ruby  rails  roles 
november 2014 by edavey
The definitive guide to Arel, the SQL manager for Ruby - Jiri Pospisil's blog
Behind the scenes, ActiveRecord uses Arel to build the queries and ultimately calls out to it to get the final SQL before shipping it to the database of your choice.

So how exactly Arel achieves building the queries in such a flexible way? By building an AST. Arel internally operates on AST nodes - you modify the query via a method call, Arel modifies or creates the appropriate node in the tree.
arel  rails  ruby 
september 2014 by edavey
HAML -- Whitespace Removal: > and <
> and < give you more control over the whitespace near a tag. > will remove all whitespace surrounding a tag, while < will remove all whitespace immediately within a tag. You can think of them as alligators eating the whitespace: > faces out of the tag and eats the whitespace on the outside, and < faces into the tag and eats the whitespace on the inside. They’re placed at the end of a tag definition, after class, id, and attribute declarations but before / or =.
haml  whitespace  rails 
august 2014 by edavey
Wisper is a Ruby library for decoupling and managing the dependencies of your domain models.
pubsub  rails  ruby  soa 
august 2014 by edavey
Use .pluck If You Only Need a Subset of Model Attributes | Viget
IF YOU ONLY REQUIRE a few attributes from a table, rather than instantiating a collection of models and then running a .map over them to get the data you need, it’s much more efficient to use .pluck to pull back only the attributes you need as an array. The benefits are twofold: better SQL performance and less time and memory spent in Rubyland.
rails  ruby  pluck 
august 2014 by edavey
Serving Compressed Assets With Heroku and Rack-Zippy
Serving Compressed Assets With Heroku and Rack-Zippy
It’s often a little known fact that Heroku does by default , NOT serve the compressed version of your assets to the client browser.

Often it’s all too easy to get lost in the magic that is Heroku slug compilation and the simplicity of a “git push heroku master” code deploy that we forget the basics of web development and end up serving our clients bloated CSS and JavaScript files, often at ridiculous sizes.
heroku  performance  rails 
march 2014 by edavey
Set up your server to host Ruby on Rails apps.
chef  rails  devops  sysadmin 
february 2014 by edavey
Rails + AngularJS - A generic approach
One of the best things I found with the mix Rails+AngularJS is that you can have many small AngularJS applications in your project. In my case one thing is very important to me is that AngularJS doesn’t manipulates DOM, all you want to do in your view is html and some new elements, in html too, but reading a template, you can understand what’s happened all the time.
angular  rails  javascript 
january 2014 by edavey
Errors, more of them, and better. For sprockets, specifically sprockets-rails. The goal of this library is to make it painfully obvious when you've done something wrong with the rails asset pipeline
asset_pipeline  rails 
december 2013 by edavey
Slow Tests Are the Symptom, Not the Cause | via @codeship
In this refactoring walk-through we will see how small, incremental improvements to the design of a rails app, and specifically, decoupling, naturally lead to faster tests. We will extract service objects, completely remove all rails dependencies in test time and otherwise reduce the amount of coupling in the app.
ruby  rails  refactoring  oo_design 
october 2013 by edavey
Sandi Metz’ rules for developers
Sandi Metz’ rules for developers

Back in January, Sandi Metz introduced her rules for developers in a Ruby Rogues podcast episode episode. When Sandi’s rules were published, I was starting a new project. This post details the experience of that team applying Sandi’s rules to that project.
development  ruby  rails 
may 2013 by edavey
Chef cookbooks for busy Ruby developers -
Have you ever setup a Rails production environment from scratch, by hand? If you had, I share your pain every time when a new project started.

The process is often repetitive. To me, it seems to be a waste to do it manually every time. It also consumes time and attention. It would be great if I could spend them on tasks that bring more values to clients.

To minimize such waste, I have written two Chef cookbooks to automate the process:

rackbox - to provision rack-based web server (Nginx as front server, Unicorn and Passenger as upstream app servers, rbenv as ruby version manager).
databox - to provision database server (supports MySQL and PostgreSQL).
chef  rails  ruby  sysadmin 
april 2013 by edavey
natritmeyer/site_prism · GitHub
SitePrism gives you a simple, clean and semantic DSL for describing your site using the Page Object Model pattern, for use with Capybara in automated acceptance testing.
capybara  ruby  rails  cucumber  testing 
march 2013 by edavey
sj26/mailcatcher · GitHub
Catches mail and serves it through a dream.
mail  rails  ruby  email 
february 2013 by edavey
griddler/ at master · thoughtbot/griddler · GitHub
Receive emails in your Rails app

Griddler is a Rails engine (full plugin) that provides an endpoint for the SendGrid parse api that hands off a built email object to a class implemented by you.
development  ruby  rails  email  messaging  sendgrid 
february 2013 by edavey
tadast/sublime-rails-snippets · GitHub
The repo aims to replace the default Rails snippets from Sublime Text 2 and make it useful for Ruby ~> 1.9 and Rails ~> 3.1. All the snippets can be found in this cheatsheet generated by Snipcheat.
rails  developmet  sublime_text 
january 2013 by edavey
A love affair with PostgreSQL [Rails 4 Countdown to 2013] | The Remarkable Labs Blog
Out of all the supported databases available in Active Record, PostgreSQL received the most amount of attention during the development of Rails 4. In today's countdown post, we are going to look at the various additions made to the PostgreSQL database adapter.
postgres  rails  ruby  rails4 
january 2013 by edavey
Squeel lets you write your ActiveRecord queries with fewer strings, and more Ruby, by making the ARel awesomeness that lies beneath ActiveRecord more accessible.
activerecord  rails  ruby  development  arel 
november 2012 by edavey
ActiveModel modules for all your non-persisted form data
Active Model Helper Modules reduce the complexity of validations on your plain old Ruby objects.
validation  ruby  rails  activemodel 
october 2012 by edavey
New Tabs and Cucumber // The Programming Butler
While working on an internal app at GitHub I had to write a cucumber scenario that ran expectations against a new tab that was opened. Here is how I did it.
cucumber  ruby  rails  development  testing 
march 2012 by edavey
This gem is a no config solution for the wonderful Premailer gem to be used with Rails 3. It uses interceptors which were introduced in Rails 3 and tweaks all mails which are delivered and adds a plain text part to them and inlines all CSS rules into the HTML part.
rails  ruby  development  email 
march 2012 by edavey
jonleighton/poltergeist - GitHub
Poltergeist is a driver for Capybara. It allows you to run your Capybara tests on a headless WebKit browser, provided by PhantomJS.
capybara  javascript  ruby  rails  development  testing  PhantomJS 
january 2012 by edavey
njonsson/cape - GitHub

You use Capistrano to deploy your application, and
You have Rake tasks you want to run remotely — but you don’t want to hand-code Capistrano recipes for each Rake task —

You can use the Cape DSL within Capistrano recipes to dynamically add recipes for your application’s Rake tasks, and
You can run your Rake tasks on your deployed servers, friction-free, and look like a superhero. [cue fanfare]
rails  rake  ruby  development  sysadmin  deployment  capistrano 
december 2011 by edavey
myronmarston/mail_safe - GitHub
Mail safe provides a safety net while you’re developing an application that uses ActionMailer. It keeps emails from escaping into the wild.

Once you’ve installed and configured this gem, you can rest assure that your app won’t send emails to external email addresses. Instead, emails that would normally be delivered to external addresses will be sent to an address of your choosing, and the body of the email will be appended with a note stating where the email was originally intended to go.
mail  testing  ruby  rails  development 
december 2011 by edavey
josevalim/active_model_serializers - GitHub
Rails Serializers

This guide describes how to use Active Model serializers to build non-trivial JSON services in Rails. By reading this guide, you will learn:

When to use the built-in Active Model serialization
When to use a custom serializer for your models
How to use serializers to encapsulate authorization concerns
How to create serializer templates to describe the application-wide structure of your serialized JSON
How to build resources not backed by a single database table for use with JSON services
This guide covers an intermediate topic and assumes familiarity with Rails conventions. It is suitable for applications that expose a
JSON API that may return different results based on the authorization status of the user.
api  rails  json  serialization  development 
december 2011 by edavey
MailCatcher runs a super simple SMTP server which catches any message sent to it to display in a web interface. Run mailcatcher, set your favourite app to deliver to smtp:// instead of your default SMTP server, then check out to see the mail that's arrived so far.
rails  development  mail  smtp 
october 2011 by edavey
MiniTest::Spec setup with Capybara in Rails 3.1 - Code Ningja
I just started a new Rails 3.1 project. I decided to use MiniTest::Spec for all my testing. I also wanted to use my typical testing tools: Capybara, Spork, etc. I didnt' find much support for MiniTest, and even less for MiniTest::Spec. Here’s some documentation on what I ended up with.
minitest  rails  ruby  testing  development  capybara 
october 2011 by edavey
Speeding up Rake and Rails in Ruby 1.9.2 @ RambleOn
patch ruby 1.9.2 - I got 40% speedup in unit test time!
ruby  development  rails 
september 2011 by edavey
jcasimir/draper - GitHub
This gem makes it easy to apply the decorator pattern to domain models in a Rails application. This pattern gives you three wins:

Replace most helpers with an object-oriented approach
Filter data at the presentation level
Enforce an interface between your controllers and view templates.
DDD  rails  ruby  presenter  decorator 
august 2011 by edavey
query_trace | | your community gem host
With query_trace enabled, the Rails logs will contain a partial stack trace for every executed SQL statement, making it easier to find where they are generated in your code.
rails  performance  profiling  ruby 
june 2011 by edavey
brynary/rack-bug - GitHub
Rack::Bug adds a diagnostics toolbar to Rack apps. When enabled, it injects a floating div allowing exploration of logging, database queries, template rendering times, etc.
performance  profiling  ruby  rails  rack 
june 2011 by edavey
Isotope – Hybrid Ruby on Rails Template Engine for Client Side and Server Side (Updated)
The problem:
In Ajax-based sites, there’s a constant dilemma: How to get objects rendered in templates? In server side (and output full HTML)? Client side (and mess with JSON objects and HTML strings/DOM generation)?
What should be the role division between server and client?
javascript  template  rails  ruby 
may 2011 by edavey
Ruby Geocoder
Complete Ruby geocoding solution.

easy to use • supports Ruby 1.8, 1.9, and JRuby • compatible with ActiveRecord and Mongoid • result caching • proxy support • multi-lingual • Google, Yahoo, Bing,,, and FreeGeoIP geocoding services • works with Rails, Sinatra, any Rack framework • command line interface
ruby  rails  development  geo_spatial 
may 2011 by edavey
« earlier      
per page:    204080120160

Copy this bookmark:

to read