Oshuma / app_config

Simple Ruby framework-agnostic application configuration.
http://oshuma.github.io/app_config/
MIT License
20 stars 7 forks source link

When writing to initially NULL value, PG::Error is thrown. #23

Closed Oshuma closed 11 years ago

Oshuma commented 11 years ago

In this example, AppConfig has been setup with the Postgres defaults and a column named api_key however, there are currently no rows in the configured database.

irb(main):004:0> AppConfig.api_key
=> nil
irb(main):006:0> AppConfig.api_key = 'foobar'
=> "foobar"
irb(main):007:0> AppConfig.save!
PG::Error: ERROR:  syntax error at or near "WHERE"
LINE 1: UPDATE app_config SET  WHERE id =
                               ^

This is happening because the initial call to fetch_data! returns no results.