Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ limitation. Some of these carriers are include, Mobitel, Etisalat, T-Mobile (Ne

== View Helpers (Rails)

* Include SMSFuHelper in controller or helper module

include SMSFuHelper

* Retrieve a collection of all carriers

<%= carrier_collection %>
Expand Down
7 changes: 5 additions & 2 deletions lib/sms_fu/sms_fu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down