forked from rymai/devise_invitable
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Avlok Kohli
committed
Jun 17, 2010
1 parent
0266a18
commit e762300
Showing
7 changed files
with
45 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
Devise::Controllers::UrlHelpers.module_eval do | ||
[:path, :url].each do |path_or_url| | ||
[nil, :new_, :accept_].each do |action| | ||
class_eval <<-URL_HELPERS | ||
def #{action}invitation_#{path_or_url}(resource, *args) | ||
resource = case resource | ||
when Symbol, String | ||
resource | ||
when Class | ||
resource.name.underscore | ||
else | ||
resource.class.name.underscore | ||
end | ||
send("#{action}\#{resource}_invitation_#{path_or_url}", *args) | ||
module DeviseInvitable | ||
module Controllers | ||
module UrlHelpers | ||
[:path, :url].each do |path_or_url| | ||
[nil, :new_, :edit_].each do |action| | ||
class_eval <<-URL_HELPERS, __FILE__, __LINE__ + 1 | ||
def #{action}invitation_#{path_or_url}(resource, *args) | ||
resource = case resource | ||
when Symbol, String | ||
resource | ||
when Class | ||
resource.name.underscore | ||
else | ||
resource.class.name.underscore | ||
end | ||
send("#{action}\#{resource}_invitation_#{path_or_url}", *args) | ||
end | ||
URL_HELPERS | ||
end | ||
URL_HELPERS | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,5 @@ module DeviseInvitable::Mailer | |
def invitation(record) | ||
setup_mail(record, :invitation) | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
module DeviseInvitable | ||
class Engine < ::Rails::Engine | ||
paths.lib = "lib" | ||
|
||
initializer "devise_invitable.add_url_helpers" do |app| | ||
ActionController::Base.send :include, DeviseInvitable::Controllers::UrlHelpers | ||
ActionView::Base.send :include, DeviseInvitable::Controllers::UrlHelpers | ||
end | ||
|
||
config.after_initialize do | ||
I18n.load_path.unshift File.expand_path(File.join(File.dirname(__FILE__), 'locales', 'en.yml')) | ||
Devise::Mailer.send :include, DeviseInvitable::Mailer | ||
end | ||
|
||
end | ||
end | ||
end |