Skip to content

Commit 18e506f

Browse files
committed
Adds database configuration
1 parent 4d0a812 commit 18e506f

File tree

5 files changed

+49
-20
lines changed

5 files changed

+49
-20
lines changed

.gitignore

-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
#----------------------------------------------------------------------------
2-
# Ignore these files when commiting to a git repository.
3-
#
4-
# See http://help.github.com/ignore-files/ for more about ignoring files.
5-
#
6-
# The original version of this file is found here:
7-
# https://github.com/RailsApps/rails-composer/blob/master/files/gitignore.txt
8-
#
9-
# Corrections? Improvements? Create a GitHub issue:
10-
# http://github.com/RailsApps/rails-composer/issues
11-
#----------------------------------------------------------------------------
12-
131
# bundler state
142
/.bundle
153
/vendor/bundle/
@@ -28,7 +16,6 @@ db/*.sqlite3
2816
.redcar/
2917
.sass-cache
3018
/config/config.yml
31-
/config/database.yml
3219
/coverage.data
3320
/coverage/
3421
/db/*.javadb/

README.md

+16-7
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,19 @@ This is a simple app using the Interactor gem.
77

88
### What does this app do ?
99

10-
* Use interactors in order to handle the new comment
11-
* One interactor to actually store the comment
12-
* One to send a ThankYou message to the commenter (not really send anything)
13-
* One to log the event through a Mixpanel kind of app (not really logging anything)
14-
* Show an example of a rollback, just check the box before adding a comment
15-
* Show an example of hook usage
16-
* The code also contains some test best practices
10+
* [x] Use interactors in order to handle the new comment
11+
* [x] One interactor to actually store the comment
12+
* [x] One to send a ThankYou message to the commenter (not really send anything)
13+
* [x] One to log the event through a Mixpanel kind of app (not really logging anything)
14+
* [x] Show an example of a rollback, just check the box before adding a comment
15+
* [x] Show an example of hook usage
16+
* [ ] Show an example with multiple hooks
17+
* [ ] The code also contains some test best practices
18+
19+
### Setting up the app
20+
21+
```
22+
$> [email protected]:beNjiox/interactor-sample.git
23+
$> cd interactor-sample
24+
$> rake db:migrate
25+
```

app/interactors/log_comment.rb

+2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ class LogComment
33

44
def call
55
Rails.logger.info '#3 - LogComment'
6+
# Here you can for example invoke the Mixpanel API to log your event
7+
# Mixpanel::Tracker.new(ENV['MIXPANEL_PROJECT_TOKEN']).track(context.comment.email, 'A user commented the GuestBook')
68
end
79
end

app/interactors/send_thank_you.rb

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ def call
55
if context.fake_fail == true
66
context.fail!(:message => 'You checked the fake fail checkbox... we can\'t continue!')
77
else
8+
# Here you can send a email to the commenter
9+
# CommenterMailer.thank_you_email(context.comment.email)
810
Rails.logger.info '#2 - SendThankYou'
911
end
1012
end

config/database.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
development:
2+
adapter: postgresql
3+
host: localhost
4+
encoding: unicode
5+
database: interactor-sample_development
6+
pool: 5
7+
username: interactor-sample
8+
password:
9+
template: template0
10+
11+
test:
12+
adapter: postgresql
13+
host: localhost
14+
encoding: unicode
15+
database: interactor-sample_test
16+
pool: 5
17+
username: interactor-sample
18+
password:
19+
template: template0
20+
21+
production:
22+
adapter: postgresql
23+
host: localhost
24+
encoding: unicode
25+
database: interactor-sample_production
26+
pool: 5
27+
username: interactor-sample
28+
password:
29+
template: template0

0 commit comments

Comments
 (0)