RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  
 
December 20, 2014
I just wrote a JSON aggregation library that I thought would be a fairly common use-case. A write up on that is available here
December 19, 2014
Testing logging in Ruby with StringIO
In this post we’ll learn how Ruby objects are mapped in JavaScript-land by the Opal compiler, how to call methods on them and how object instantiation works for both Ruby and JavaScript.
December 18, 2014
Learn how to Deploy Ruby on Rails To Your Own Server with this video tutorial series using Ubuntu, Postgres, Nginx, and Unicorn.
Repository Driven Infrastructure helps managing your infrastructure from your repository. Developers describe their intent to deploy, the system picks it up and follows through on it.

Repository Driven Infrastructure
One of Rails' most visible historical protections against malicious data corruption involved using the attr_accessible method within a model to identify which model attributes could be passed into methods like new and update_attributes for mass assignment. This changed with Rails 4, thanks to a new approach for managing mass assignment behavior. Known as strong parameters, the task of defining which parameters are available for mass assignment has been moved out of the model and into the controllers, allowing developers to define mass assignment behavior according to action. In this tutorial, I'll introduce you to strong parameters, and include several usage examples.
I just released v1.0.3 of search_cop which brings support for Rails 4.2.
Happy searching.
December 17, 2014
Small guide about adding elegant permalinks to your Rails app using the friendly_id gem.
Just blogged about the difference between server side HTML rendering and the use of an API.

http://pothibo.com/2014/12/losing-context-with-json
Have you ever used Hashie? You may (not) be surprised that it's a horrible idea. But you may interested to learn hashie is responsible for a 5% decrease in all app speed if you're using omniauth. To learn more about why having an object that inherits from hash and acts like an object, read hashie considered harmful
I wrote a new post titled A Ruby Refactor: Exploring Dependency Injection Options. Hope you enjoy!
December 16, 2014
Here I listed my experience with DataMapper 2 which wasn't released and ROM (inheritor of DataMapper 2). We already started using it and I guess our experience may be interesting for other developers as well.
One of the big gotchas of Ruby metaprogramming is the need to keep method_missing and respond_to_missing? in sync. I've just published the hook_lying_syncer gem (code on Github) to help with this. See the README on Github for details.
Where Does Your Code Go?  justinweiss.com
After you finish the Rails tutorials and start your own app, things get confusing. Like where does your non-CRUD, general logic go? How does grabbing followers from Twitter fit into MVC? Ask two people, and you get four answers. So where do you put your code, and still keep things simple?
I recently wrote a post where I show some code displaying the contrast between using value objects and setter methods.
After the continued success of three editions of Baruco and one of FutureJS, we are already working on a new twist for 2015, and we are proud to announce it today: Full Stack Fest.
I just decided to write a blog post about Service Objects, which is a pretty controversial topic these days. Hope there will be a lot of comments and stormy discussion :)
I've uploaded a new pluto version, that is, v1.1.0. What's pluto? A free planet site generator for building web pages from published web feeds e.g. Planet Ruby, Planet JavaScript, etc.
What's news? The pluto gem is now split up into five gems. The lineup includes: pluto, pluto-models, pluto-update, pluto-merge, pluto-tasks The idea is to make it easier to use what you need and make it easier to change to your needs. All planet temlates (e.g. hacker, news, digest, etc.) moved to its own GitHub org, that is, planet-templates and you can now install planet templates w/ npm too e.g. $ npm install planet-top. Happy planet. Cheers.
December 15, 2014
Our new tutorial talks about how to set up production Rails deployment with Nginx and Unicorn.

Rails Production Deployment with Nginx and Unicorn

Enjoy!
I just launched ToCardinal gem and I really would like that you give me some feedback to improve it. I have two purposes, contribute to community and learn about this. So I’ll appreciate your comments.
Some people, when confronted with a problem, think: "I know, I'll use UA/device detection!" Now they have two problems... Service Worker solves this problem: instead of guessing on the server, we can (finally) teach the client to report the necessary values!
models_stats gem - it's graphics for your rails models with MetricsGraphics.js and NVD3. It may show count(or average, or sum, or another sql agregate function) of models for each day with grouping, conditions. It uses Redis for store statistics.
December 14, 2014
New necromancer includes more array conversions and ability to configure global options such as strict mode.
PgHero is a ruby gem that gives you insights of your PostgreSQL database: cache hit rate, which queries are too slow, which tables need indexes, and more. Here's how it looks on a production RoR app.
December 12, 2014
Hash Tricks in Ruby  thirtysixthspan.com
A few ways to get more mileage out of Ruby hash.
I just released a new version of proxy_pac_rb. It uses now thor for commandline parsing and supports a new command to compress an existing proxy.pac.
I recently found about Curses, framework for making Terminal applications, and ruby/curses. I was really interested in how the Terminal works and how can you make a Terminal application (without any framework), which I intend to write a blog post about. Here I wanted to demonstrate how Curses can be used in Ruby.

Now, this isn't some amateur 3x3 Tic-tac-toe implementation; the size of the board is configurable, as well as number of players (up to 5!) and the goal (how many in the row). It's main purpose is for playing on production servers ;P

https://github.com/janko-m/tic-tac-toe
I've updated the slideshow (S9) machinery. Now you can use npm to install slideshow template packs (e.g. s5, s6, slidy, deck.js, etc.). For example to install the slideshow-impress.js pack type: $ npm install slideshow-impress.js No magic here. The npm package manager will download and copy the package to your working folder in the node_modules/ folder. That's it. Now the template pack is ready to use with Slide Show (S9) e.g. try $ slideshow new -t impress.js and so on. More details at the Slide Show (S9) project site. Cheers.
December 11, 2014
Learn how to deploy Ruby on Rails 4.1 to a Ubuntu 14.04 server using Capistrano 3.
Just realized sugarcane never worked on OSX because I wrote it while on Linux. It uses ncurses-ruby instead of ncursesw now.

https://github.com/rlqualls/sugarcane/
$ gem install sugarcane

#ncursesproblems
Recently I have had to stub API responses in our tests when an user uses pagination. We have the pagination similar to the pagination of Facebook: you scroll down and you receive new items in the list. It was challenging, because SitePrism.Vcr only allows you to link VCR cassettes with elements and pages.

Continue reading
Here's a nifty rake task to disable dangerous rake tasks in production, like `rake db:schema:load`. Developed after we killed our production database by mistake :-)
Generally integrating bower with Rails require using rails-assets gem wrappers, or bower-rails gems. Recently we stumbled upon sprockets inbuilt ability to detect bower packages, and integrate those packages into asset pipeline. You can read more about it here: Cake walk: Using bower with rails
December 10, 2014
Upgrade to rails 4!  bloginius.com
Are you planning to finally bump your app to the rails 4.0? Check out my article, it will help you!
I wrote a post about a simple middleware that can help you ensure, that you don't have any nofollow links that you don't want. You can read about it here: Rack/Rails middleware that will add rel="nofollow" to all your links
Spree is an open source Ruby on Rails e-commerce platform with a growing community around. If you already use the tool, it's worth to check this collection of free extensions for Spree storefronts aiming at making the experience more user friendly.
hijri is full Islamic Hijri calendar library for ruby. It is a lunar calendar consisting of 12 lunar months in a year of 354 or 355 days.

I just release version 0.2.0
December 09, 2014
It's only five lines of code, but it takes a blog post to highlight the finer points of the solution.
I posted the first ruby scripts I ever wrote, look at them and the motivation to do so. Want to share your first ruby scripts? Tweet them out with #myfirstrubyscript
What happens when you have a bad abstraction? You have to dig out the API reference every time to understand what that method that clearly should have been named leaderboard is actually called. And whenever you touch the code, something breaks, and you blow the rest of your day trying to debug it (because you tweaked position, but didn’t update score at the same time). So how do you build good abstractions, while staying far away from the bad?
I’d like to share with you “the switch” I made from PHP to Rails, summarized in 5 points.
Learn how to properly configure a Ubuntu 14.04 server to deploy Ruby on Rails 4.1.
I just wrote a simple example of using routes constraints link. It's really helpful when we can update one object in many places.
Continuing my articles about forwarding and object responsibilities, I just released a new post about the benefits of managing change using a common interface.
I wasn’t at Ruby Conf, but I followed it vicariously via various social media channels.
There is a huge amount of action in Ruby at the moment, including a ton of focus on performance.
Continue reading The Vibe.
A new post up at the blog about data sets with FactoryGirl.
December 08, 2014
After several months in production, Gemnasium is getting back to the auto-update feature, and explains why it is way more difficult than expected. Read the article here.
mina_maintenance is a maintenance mode for mina deploy. Heavily inspired by Capistrano::Maintenance. Feel free to try it and share your thoughts!
Introducing Traveling Ruby  phusion.github.io
Traveling Ruby lets you easily ship Ruby apps to end users. Use Traveling Ruby to create self-contained Ruby app packages for Linux and OS X. Completely open source, MIT licensed.
Figuring out how to use Ember-style computed properties in Ruby Gamebox.