I just published my first ruby gem on rubygems.org. It is a simple gem that is useful in case you need to find out if one number is divisible by another.


  9.divisible_by(3) # => true
  10.divisible_by(3) # => false
  12.divisible_by(3) # => true
  12.divisible_by(4) # => true
  15.divisible_by(4) # => false

Same can be done with

  Divisible.check(9, 3) # => true
  Divisible.check(10, 3) # => false
  Divisible.check(12, 3) # => true
  Divisible.check(12, 4) # => true
  Divisible.check(15, 4) # => false


  gem install divisible

For more info go to https://github.com/vlado/divisible

MarkItUp: Rails plugin that turns any textarea into a markup editor

I recently published a plugin that helps you turn any textarea into a markup editor. It is based on excellent markItUp! jQuery plugin.


The most simple usage with preset defaults

  <%= javascript_include_tag "path/to/jquery" %>
  <%= mark_it_up '#miu_test' %>
  <%= form_tag do %>
    <%= text_area_tag "miu_test" %>
  <% end %>

You can see a lot more cool examples in action on markitup.cingel.hr.

More info


Simple Search Rails plugin

SimpleSearch brings simple search to ActiveRecord. It ads simple_search named scope that accepts query as parameter.

The idea is that you provide the query and plugin does the rest (splits query to keywords and compose where statement).

This can be very useful in case you just want to filter list of records by some query, you have autocomplete field, … or something similar.

Continue reading “Simple Search Rails plugin”

Create new app with specific Rails version

I recently installed Rails 3 beta release but I needed to create new app with the 2.3.5. version. I was searching for a way to do that and I found this

  rails _2.3.5_ appname

Unfortunately this will produce an error similar to this

  /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:827:in `report_activate_error': RubyGem version error: railties(3.0.0.beta not = 2.3.5) (Gem::LoadError)
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:261:in `activate'
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:68:in `gem'
	from /usr/local/bin/rails3:18

To fix this first run

Continue reading “Create new app with specific Rails version”