Archive for category metaprogramming
Enumerable grep method in Ruby
Posted by Hallelujah in best practices, metaprogramming, rails, ruby on August 19, 2010
There is some methods that are not very known among ruby developpers. One of them is Enumerable#grep method. I would like to share one of the use case I have to face with, and how I implement grep. Purpose, I have a Hash representing a simple network I’d like to select all the people related [...]
best practice, best practices, hash, méta-programmation, meta-programming, metaprograming, métaprogrammation, rails, regexp, ror, ruby, ruby on rails, tips
Mysql 4.x and Rails : RELEASE SAVEPOINT issue
Posted by Hallelujah in active_record, activerecord, metaprogramming, mysql, rails, ruby on March 11, 2010
Today with a project using mysql 4.1.22 that I have to implement some tests, I ran this error with rails 2.3.5 and I think for 2.3.x branch. Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘RELEASE SAVEPOINT [...]
gettext 2.0.4 and rails 2.3.4
Posted by Hallelujah in Uncategorized, metaprogramming, rails, ruby on October 8, 2009
Rails 2.3.4 broke gettext_activerecord 2.0.4 Well I did not test other gems of the mutoh gettext set of libraries but here is the gulty code that breaks rails. Since Activerecord::Errors changed its implementation a bit, an error like this is raised : NoMethodError: undefined method `gsub’ for #<ActiveRecord::Error:0×00000002919738> from /home/hallelujah/Jail/lib/ruby/gems/1.9.1/gems/gettext_activerecord-2.0.4/lib/gettext_activerecord/validations.rb:165:in `localize_error_message’ from /home/hallelujah/Jail/lib/ruby/gems/1.9.1/gems/gettext_activerecord-2.0.4/lib/gettext_activerecord/validations.rb:112:in `block (2 [...]
2.0.4, 2.3.4, activerecord, active_record, gettext, I18n, internationalisation, internationalization, L10n, localization, rails, ruby
Inspectable accessors
Posted by Hallelujah in Uncategorized, metaprogramming, ruby on September 23, 2009
Hey, it’s been a while I posted here. So what’s the purpose ? I commonly use script/console to debug my rails applications. Today I wanted to see the values of my custom attributes model without typing model.custom_attribute. So I took a look at ActiveRecord::Base#inspect method. and the default inspect method shows me database fields. Well, [...]
accessor, inspect, méta-programmation, meta-programming, metaprograming, métaprogrammation, rails, ruby, tips
Blocks are Proc : Les procédures Proc et les blocks en ruby.
Posted by Hallelujah in base, best practices, metaprogramming, ruby on July 24, 2009
( For non-french readers : I am not giving up writing in english … Read the next post! ) Si vous venez d’un autre langage, le terme procédure (associé au terme fonction) doit vous dire quelque chose. Vaguement …. Allez quelques connaissances (méconnaissances) tirées de ma mémoire pour poser les bases. Par exemple, en PHP [...]
base, méta-programmation, meta-programming, metaprograming, métaprogrammation, novice, ruby
-
You are currently browsing the archives for the metaprogramming category.
Search
Tags
2.0.4 2.3.4 About accessor activerecord activesupport active_record active_support base best practice best practices bundler column columns email gem gemfile gettext hash I18n inspect internationalisation internationalization L10n localization meta-programming metaprograming mysql méta-programmation métaprogrammation news novice programmation rails regexp ror ruby ruby on rails sort sorting tips validate validations validator wirblePages
Archives
- August 2010 (1)
- July 2010 (2)
- June 2010 (1)
- March 2010 (1)
- October 2009 (2)
- September 2009 (2)
- July 2009 (3)
Blogroll
Ads
