Some time ago I promised to create a small tutorial about live fulltext search. A fulltext search, that gives you results as you type. Ingredients: Ruby on rails ferret gem (gem install ferret) acts_as_ferret gem (gem install acts_as_ferret) auto_complete plugin (from the application root: ruby script/plugin install auto_complete) What we will do Create an empty… Continue reading Live fulltext search in Ruby on Rails
Category: Ruby on Rails
Block level helpers in Ruby on Rails
Web developer often comes to a situation where he needs to “decorate” a block of a page. There is a simple solution and simple and elegant solution. Helpers concept in Ruby on Rails is very powerful and will be used to do the trick. Imagine, you want to create a rounded box helper similar to… Continue reading Block level helpers in Ruby on Rails
Rails and Grails comparison
I have spent few years developing in Ruby on Rails. For the last half of year I have been learning Grails, too. The things described here are a summarization of the differences that I had to come over. The comparison will be written in a simple “table based” structure. I just got used to it… Continue reading Rails and Grails comparison
Ad-hoc fulltext search in RoR ActiveRecord
I came to a situation where I needed to search my Active record, but I did not know which field contains the information. The solution with Ferret was just three steps away… Let’s say, you want to search Stories for ‘Giant’ keyword. You have to create a Ferret index in memory (ferret gem needs to… Continue reading Ad-hoc fulltext search in RoR ActiveRecord
Utilizing Caches.rb with Ferret
We needed to cache a Ruby class method calling the Ferret indexing engine. “Yurii Rashkovskii”:http://rashkovskii.com/tags/caches developed a great library called “Caches.rb”:http://pad.verbdev.com/cachesrb/. When I googled it out, it seemed very simple to use and promised to do *EXACTLY* what I need (even the default timeout was *JUST IT*). I especially liked the very Rails-like tutorial “Don’t… Continue reading Utilizing Caches.rb with Ferret
Calling Oracle stored procedure from rails
Sometimes it is necessary to reuse existing logic from stored procedures. This line of code shows how to call a stored procedure in Oracle. ActiveRecord::Base.connection.execute(‘BEGIN do_the_calculation; END;’)
RoR in enterprise – lessons learned
After a while my first enterprise prototype is finished and I have to summarize what was right and what was wrong during the period of prototyping. Really nice surprise for me was the way of communication. The requirements were formulated more precisely then any requirement before, but not from the beginning. When I did start,… Continue reading RoR in enterprise – lessons learned
From pictures to picturables
This article tries to explain how to convert existing class in Ruby on Rails to a class that can be used in polymorphic association class. As the beginning, I do recommend to read article about polymorphic associations. It explains what they are and how they work. The whole process will be described on classes Picture… Continue reading From pictures to picturables
acts_as_ferret tip: uninitialized constant Ferret::Index::FieldInfos
I have upgraded acts_as_ferret plugin to the latest version and my fulltext search stopped searching. It was throwing an error message: NameError (uninitialized constant Ferret::Index::FieldInfos): /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:263:in `load_missing_constant’ /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:in `const_missing’ .//vendor/plugins/acts_as_ferret/lib/acts_as_ferret.rb:119:in `field_infos’ .//vendor/plugins/acts_as_ferret/lib/local_index.rb:58:in `rebuild_index’ .//vendor/plugins/acts_as_ferret/lib/local_index.rb:37:in `ensure_index_exists’ .//vendor/plugins/acts_as_ferret/lib/local_index.rb:9:in `initialize’ .//vendor/plugins/acts_as_ferret/lib/class_methods.rb:304:in `new’ .//vendor/plugins/acts_as_ferret/lib/class_methods.rb:304:in `create_index_instance’ .//vendor/plugins/acts_as_ferret/lib/class_methods.rb:55:in `aaf_index’ .//vendor/plugins/acts_as_ferret/lib/class_methods.rb:120:in `find_id_by_contents’ .//vendor/plugins/acts_as_ferret/lib/class_methods.rb:176:in `ar_find_by_contents’ .//vendor/plugins/acts_as_ferret/lib/class_methods.rb:170:in `find_records_lazy_or_not’ .//vendor/plugins/acts_as_ferret/lib/class_methods.rb:86:in `find_by_contents’ If you observe the… Continue reading acts_as_ferret tip: uninitialized constant Ferret::Index::FieldInfos
RSpec for Ruby on Rails
Behaviour driven development is currently in. The best ay how to get in touch with it is to setup your own environment and make few examples.Nevertheless, if you prefer to start with a bit of theory, go to http://behaviour-driven.org/.This article describes simple procedure to setup Rspec to work together with ruby on rails. Installation of… Continue reading RSpec for Ruby on Rails