Archive for September, 2009

Hut touring equipment list

September 27th, 2009 by pyrat

Things to take when touring hut to hut in Norway.

Silk liner
Silk pillowcase
Down jacket
Waterproof jacket
Waterproof trousers
Light fleece
Thermal tops x2
Torch
Spare batteries for torch
Thermal bottoms
Leisure sock x1
Hiking socks
Blister prevention and treatment
First aid
Camera
Indoor shoes (slippers)
Boots
Compass
Map
Toiletries
Book
Key
Hat
Gloves
Buff



Configurable ActiveResource Site Variable

September 16th, 2009 by pyrat

flickr

Documentation on ActiveResource is fairly thin on the ground.

If you are using ActiveResource in the real world it is likely that you will want to use different webservices depending on what environment you are in. (Staging, Development, CI, Production etc.)

Heres how to do it. This assumes the REST api has been put under the api namespace and has been setup with HTTP Authentication.

config/initializers/config.rb

  raw_config = File.read(RAILS_ROOT + "/config/config.yml")
  GLOBAL = YAML.load(raw_config)
  APP_CONFIG = GLOBAL[Rails.env]

config/config.yml

  development:
      webservice: http://username:password@localhost:3001/api/
  test:
      webservice: http://username:password@localhost:3001/api/
  staging:
      webservice: https://username:password@staging.com/api/
  production:
      webservice: https://username:password@production.com/api/

app/models/incometype.rb_

  class IncomeType < ActiveResource::Base
    self.site = APP_CONFIG['webservice']
  end

Here is a great railscast on the subject.

Halvard happy with chanterels

September 11th, 2009 by pyrat

Halvard found about 3kg of chanterels in storlidalen.