From 6983d4c59436c2a8f35f25f34b89dfc69adeb980 Mon Sep 17 00:00:00 2001 From: Jade Tucker Date: Thu, 7 Oct 2010 17:34:52 -0700 Subject: [PATCH 1/2] fixed problem with deprecated RAILS_x methods on Rails 3 and updated readme with instructions for including view helper methods --- README.rdoc | 4 ++++ lib/sms_fu/sms_fu.rb | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.rdoc b/README.rdoc index c1b12af..ee22d54 100644 --- a/README.rdoc +++ b/README.rdoc @@ -113,6 +113,10 @@ limitation. Some of these carriers are include, Mobitel, Etisalat, T-Mobile (Ne == View Helpers (Rails) +* Include SMSFuHelper in ApplicationHelper (or any controller helper module) + + include SMSFuHelper + * Retrieve a collection of all carriers <%= carrier_collection %> diff --git a/lib/sms_fu/sms_fu.rb b/lib/sms_fu/sms_fu.rb index a65f419..d14efc4 100644 --- a/lib/sms_fu/sms_fu.rb +++ b/lib/sms_fu/sms_fu.rb @@ -99,8 +99,11 @@ def valid_number?(number) end def template_directory - directory = defined?(Rails) ? "#{RAILS_ROOT}/config" : "#{File.dirname(__FILE__)}/../../templates" - if (defined?(Rails) && Rails.env == 'test') || (defined?(RAILS_ENV) && RAILS_ENV == 'test)') + rails_root = defined?(Rails) ? Rails.root : (defined?(RAILS_ROOT) ? RAILS_ROOT : nil) + env = defined?(Rails) ? Rails.env : (defined?(RAILS_ENV) ? RAILS_ENV : nil) + + directory = !rails_root.nil? ? "#{rails_root}/config" : "#{File.dirname(__FILE__)}/../../templates" + if env == 'test' "#{File.dirname(__FILE__)}/../../templates" else directory From af6e50bc1f259bb1a4fb10b6e3deb93a9b80cdc9 Mon Sep 17 00:00:00 2001 From: Jade Tucker Date: Thu, 7 Oct 2010 21:23:18 -0700 Subject: [PATCH 2/2] fixed problem with deprecated RAILS_x methods on Rails 3 and updated readme with instructions for including view helper methods --- README.rdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rdoc b/README.rdoc index ee22d54..d0e4e67 100644 --- a/README.rdoc +++ b/README.rdoc @@ -113,7 +113,7 @@ limitation. Some of these carriers are include, Mobitel, Etisalat, T-Mobile (Ne == View Helpers (Rails) -* Include SMSFuHelper in ApplicationHelper (or any controller helper module) +* Include SMSFuHelper in controller or helper module include SMSFuHelper