forked from lifo/cramp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Teach some AR to the application generator
Example: $ cramp new liveblog --with-active-record
- Loading branch information
Showing
7 changed files
with
49 additions
and
1 deletion.
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
4 changes: 4 additions & 0 deletions
4
lib/cramp/generators/templates/application/app/actions/base_action.rb
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,2 +1,6 @@ | ||
class BaseAction < Cramp::Action | ||
<% if active_record? %>use_fiber_pool do |pool| | ||
# Called everytime after a fiber is done with a callback | ||
pool.generic_callbacks << proc { ActiveRecord::Base.clear_active_connections! } | ||
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,4 +1,5 @@ | ||
require './application' | ||
|
||
# bundle exec thin --max-persistent-conns 1024 -V -R config.ru start | ||
<%= app_const %>.initialize! | ||
run <%= app_const %>.routes |
6 changes: 6 additions & 0 deletions
6
lib/cramp/generators/templates/application/config/database.yml
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
development: | ||
adapter: em_mysql2 | ||
database: <%= app_name %>_development | ||
host: localhost | ||
username: root | ||
pool: 100 |