aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2015-02-01 15:50:38 +0100
committerHarald Eilertsen <haraldei@anduin.net>2015-02-01 15:50:38 +0100
commitfb763dc9c7616566f3ef4b1c94d79619bd382902 (patch)
tree4b778c243316b5e1c2177e70ed8c24121182c366
parentb2ca7d8292b0d0de0ddd30c7eae1de7b817c7cde (diff)
downloadpostcodes-norway-fb763dc9c7616566f3ef4b1c94d79619bd382902.tar.gz
postcodes-norway-fb763dc9c7616566f3ef4b1c94d79619bd382902.tar.bz2
postcodes-norway-fb763dc9c7616566f3ef4b1c94d79619bd382902.zip
Add Railtie for rails integration.
-rw-r--r--lib/norwegian-postcodes.rb2
-rw-r--r--lib/norwegian-postcodes/railtie.rb11
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/norwegian-postcodes.rb b/lib/norwegian-postcodes.rb
index 22d67d5..cc3cd31 100644
--- a/lib/norwegian-postcodes.rb
+++ b/lib/norwegian-postcodes.rb
@@ -1,5 +1,7 @@
module PostCodes
+ require 'norwegian-postcodes/railtie' if defined?(Rails)
+
Counties = [
"ØSTFOLD",
"AKERSHUS",
diff --git a/lib/norwegian-postcodes/railtie.rb b/lib/norwegian-postcodes/railtie.rb
new file mode 100644
index 0000000..19cd3e7
--- /dev/null
+++ b/lib/norwegian-postcodes/railtie.rb
@@ -0,0 +1,11 @@
+require 'norwegian-postcodes'
+require 'rails'
+
+module PostCodes
+ class Railtie < Rails::Railtie
+ railtie_name :norwegian_postcodes
+ rake_tasks do
+ load 'tasks/norwegian-postcodes.rake'
+ end
+ end
+end \ No newline at end of file