teamon

  • Archive
  • RSS
  • Ask me anything

Hash extension - no more hash.try(:[], key)

    • #ruby
  • 3 months ago
  • Comments
  • Permalink
  • Share
    Tweet

Rails: timeline_fu and workflow integration

Quick tip on how to integrate timeline_fu and workflow callbacks.

    • #ruby
    • #rails
  • 10 months ago
  • 1
  • Comments
  • Permalink
  • Share
    Tweet

Run irb from file

In case I forgot.

    • #ruby
  • 1 year ago
  • Comments
  • Permalink
  • Share
    Tweet

Rails 3 remote update form

Rails 3 brings some nice unobstrusive javascript. This very short tutorial will show how to make simple yet powerful ajax update form.

First, grab jquery-ujs file (or gem). Next, create some model and REST controller.

Controller needs a small change:

Thats pretty self explaining: when object is valid send notice message, else send errors as json array.

View:

Only the :remote => true part is important.

Some JavaScript

This code will take remote form and register callbacks for showing loader, notice message and errors list.

And thats all, it simply works. And yes, you have to write CSS on your own ;]

    • #ruby
    • #rails
    • #javascript
    • #jquery
  • 1 year ago
  • 1
  • Comments
  • Permalink
  • Share
    Tweet

Uploadify, Paperclip, Rails 3 and Sessions by BitCrowd – Blog

    • #rails
    • #ruby
  • 1 year ago
  • Comments
  • Permalink
  • Share
    Tweet

Better (scoped) rails engines routing

Rails engines are really great, but they are missing one thing - putting in router scope. Fortunately, this can be easily fixed.

Instead of engine`s config/routes.rb file put all router stuff in lib/engine.rb like that:

And now it is possible to add scope:

Done!

Example gist
    • #ruby
    • #rails
    • #engines
  • 1 year ago
  • Comments
  • Permalink
  • Share
    Tweet

2,5 times faster heckle

RSpec has built-in support for heckle, but executing every “$ spec spec_file —heckle my_method” from command line is boring.

Why not use rake?

Yeah, nice one! Well, not really. “$ rake heckle_all” takes about 87 seconds to complete. First line executes shell script “spec” that runs ruby, then spec with heckle, then next line starts its own ruby again and again. Ruby starts slowly. Can it be done better?.

Yes! After some hacking I ended up with something like this:

Woohoo, “$ rake heckle_all” now takes “only” 33 seconds. Thats 2,5 times faster! ;]

Yes, I know, nothing to be excited about, but imagine you have some more code. One hour instead of two and a half! Isn`t that impressive?

It couldn`t be a benchmark post without nice chart

    • #ruby
    • #rspec
    • #heckle
  • 1 year ago
  • Comments
  • Permalink
  • Share
    Tweet

Merb app with Scala models

    • #ruby
    • #scala
    • #merb
  • 1 year ago
  • Comments
  • Permalink
  • Share
    Tweet

About

Ruby, Scala and others.

Pages

  • About
  • Projects
  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr