RubyFlow The Ruby and Rails community linklog

×

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

You can use basic HTML markup (e.g. <a>) or Markdown.
Note that your post may be edited to suit the format of the site.

As you are not logged in, you will be
directed via GitHub to signup or sign in

Post Preview

Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.

Cleanly add logging to your method calls with metaprogramming

If you’re running your Ruby scripts on a cron job, it’s important to log the output in case something goes wrong. Recording the output is as simple as appending “> somefile.txt” to your cron job. But can you avoid cluttering your code with lots of “puts” statements? Using a bit of metaprogramming, you can write a module that adds logging to whatever methods you specify. In this blog post, I’ll show you how.

I stopped taking this article seriously the moment I saw “define_method” in the…
Really? What would you use instead? Eval doesn’t seem like a good option. …
Look into how Rails implements alias_method_chain. http://metautonomo.us/2011/0…
Paul - what I’m doing is basically what that article shows, except that the nam…

Owning Basic Rails in 7 days

A few days ago I wrote a book Rails - 101, it’ about how to owning basic Rails in 7 days. Everyone knows the learning curve of Rails is alyways too high for beginners. You can’t find too much good developers in the market. In my past career, I had trained 3 profession Rails teams, over 10+ Rails developers, lead them from novice to professional. The secret is I write a tutorial to eliminate the learning curve that time. This tutorial covers many basic but important intrusions and exercises, to help them cross the first stage. So they can easily own Rails in 7 days, not months. Now, this tutorial becomes book Rails - 101. Check it out ! More story about this book.

Loading older posts