Archive for September 2009


10 Things you want to know if you start with

September 15, 2009

1. start with reading how to use git (

2. create your local git repository (git init)

3. get a free account

4. install the heroku gem (gem install heroku)

5. add your files (git add .)

6. commit your files (git commit -m „my new app“)

7. create your app @ heroku (heroku create) –> public key needed!

8. push your app to heroku (git push heroku master)

9. check the output (heroku logs)

10. add needed gems (create a .gems file in your folder and add it to the repository, each gem a new line e.g. hpricot)

11. get more Infos @ heroku (

h1 and undefined method self_and_descendants_from_active_record

September 9, 2009

We recently switched to rails 2.3.4 and noticed the following error:

undefined method self_and_descendants_from_active_record for Cart:Class

Our Cart class has no ActiveRecord binding, but we need some validations, so we simple use

@errors =

and overerride the valid? action.

But now we get the undefined method error.


Implement in your class also:

 def self.self_and_descendants_from_active_record

  def self.human_name(options = {})
    defaults = do |klass|
    defaults < [:activerecord, :models], :count => 1, :default => defaults}.merge(options))

  def self.human_attribute_name(attribute_key_name, options = {})
    defaults = do |klass|
    defaults << options[:default] if options[:default]
    defaults < defaults, :scope => [:activerecord, :attributes]))

and you can still use ActiveModel like validations 🙂


javascript value and rails I18n

September 8, 2009

Today i stumble about the following problem, i have a javascript value and want it inside a localized rails string.

„This is my string javascriptvalue and so on …“


'<%= T("This is my string ## and so on ...", :translate_string) %>'.sub(/##/, javascript_value);

i simple use javascript sub to replace ## with the javascript_value.