The Ruby and Rails community linklog
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Submit a post
Post Preview
Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.
Search with autocomplete using Twitter Typeahead
Adding simple, easy to customize and reliable autocomplete functionality has always been one of the topics that didn’t seem very clear for Rails applications until one man decided to do some serious research. Read more about his quest to find one solution that could be used without hesitation at http://blog.ragnarson.com/2016/01/25/autocomplete-with-typeahead.html
Contact form gem: EOTS (Email Of The Species)
I’ve written a gem that lets you specify as many kinds of email contact forms as you like, including having them in one or more hierarchies so you can describe their shared fields just once. You use some method calls (see the README) to specify your forms and their fields, set up your SMTP credentials as normal, and EOTS takes care of creating the forms, accepting them, and submitting them to be delivered. See https://rubygems.org/gems/eots for the gem info, https://github.com/davearonson/EOTS for “teh c0dez”, or http://www.Codosaur.us/contact to see examples of the forms. (Please don’t send me emails just to test it!)
Writing a CLI in Ruby with GLI
Building a CLI (command line interface) in Ruby is made easy with the GLI gem. This post shows how it’s done and how it can be integrated into a Rails project.
How to isolate complex queries in an object oriented fashion
Building complex queries in ruby can make your code quite difficult to read, manage and reuse. In this blog post I’ll present a simple method to decorate active record objects to make your queries fun again! [more inside]
How to write a simple web crawler in Ruby - revisited
Revisting an old post on using Ruby to write a simple web crawler, offering another perspective, borrowing ideas from existing libraries, and featuring Ruby’s Enumerator https://rossta.net/blog/how-to-write-a-simple-web-crawler-in-ruby-revisited.html
Stubbing External Services in Rails
Just published a new tutorial on how to stub external services when testing your Ruby on Rails application, for the Semaphore CI Community. Check it out here.
Is Ruby 2.3 Faster? Nested Iterator Performance
In Ruby <= 2.2 iterators like each_with_index, all?, any?, and others are creating extra Ruby objects each time you call them. When these are used inside the loop, they potentially allocate thousands of extra objects, adding more work for the garbage collector. That results in extra GC cycles that, in turn, slow down your application. Find out whether Ruby 2.3 improves this.
Run bundler-audit Regularly on Your Rails Apps with Rake
Rails developers regularly run bundler-audit to alert them to known vulnerabilities in the Ruby gems they depend on. You can run bundler-audit regularly on your Rails projects as part of your default Rake task: https://eliotsykes.com/bundler-audit
Solving Backwards Compatibility with a Proxy Object
I wrote a new article on Solving Backwards Compatibility with a Proxy Object. Hope you enjoy!
Two Factor Authentication in Rails 4 with Devise, Authy and Puppies
The most common passwords of 2015 list was just released and “123456” is top again. You can protect your users from themselves by implementing two factor authentication. Here’s how to implement two factor authentication using Rails, Devise and Authy.
Upgrading to Ruby on Rails 5.0
I just wrote a blog post about the process of upgrading one of ours Ruby on Rails apps from 4.2.5 to 5.0.0.beta1.1
Ruby Private Class Methods
In the Ruby programming language, defined methods come in two variants: instance methods and class methods. Instance methods are available after an object has been initialized, creating an instance. Class methods, on the other hand, are available without creating an instance of the class they are defined upon. However, Ruby class methods have some odd visibility quirks that might not be evident immediately.
Clearance, the other Rails authentication gem
I spent some time checking out Clearance as an alternative to Devise and my usual go-to, has_secure_password, for authenticating Rails apps. Check out my notes at Everyday Rails.
New Rails Versions with 9 CVEs fixed
http://weblog.rubyonrails.org/2016/1/25/Rails-5-0-0-beta1-1-4-2-5-1-4-1-14-1-3-2-22-1-and-rails-html-sanitizer-1-0-3-have-been-released/ Unlike usual, the version number is NOT increased in patch level but AFTER it So look closely to the post
Writing a Secure Filename Sanitization Function
One part of good security is writing a proper whitelist or blacklist function when interacting with files from users. Find out how to do that properly!
RSpec performance testing matchers
Motivated by latest failures maintaing code speed, the rspec-benchmark aims to help you prevent code performance regressions. Having benchmarks folder is fine, but automation integrated with the test suite keeps your code even more honest when refactoring. Give it a try and let me have your thoughts!
Wye Tech News #8
A new issue of our weekly compilation of interesting news and articles about Ruby, Rails, JavaScript and web development related stuff that we found during the week.
Create An Bash Function To Open Latest Active Record Migration
Opening the latest activerecord migration with those timestamps is tricky. Make it easy with this Bash function. http://solidfoundationwebdev.com/blog/posts/create-an-bash-function-to-open-latest-active-record-migration
Best practices to confident coding
“It works” — the client says after 5 or 6 clicks on the software you have created, deep breath and relax shoulders right?, next?: payment or some arrangement, after?: improvement, fixing some details… https://medium.com/@ccverak/getting-confidence-a-software-developer-perspective-1b7fee3bd643#.11yvybh76