examples/skeleton/dist/conf/merb_init.rb in merb-0.3.4 vs examples/skeleton/dist/conf/merb_init.rb in merb-0.3.7
- old
+ new
@@ -1,21 +1,24 @@
puts "merb init called"
require 'active_record'
ActiveRecord::Base.verification_timeout = 14400
ActiveRecord::Base.logger = MERB_LOGGER
-Dir[DIST_ROOT+"/app/helpers/*.rb"].each { |m| require m }
+
require DIST_ROOT+"/app/controllers/application.rb"
-Dir[DIST_ROOT+"/app/controllers/*.rb"].each { |m| require m }
-Dir[DIST_ROOT+"/app/models/*.rb"].each { |m| require m }
-Dir[DIST_ROOT+"/lib/**/*.rb"].each { |m| require m }
-Dir[DIST_ROOT+"/plugins/*/init.rb"].each { |m| require m }
+Dir[DIST_ROOT+"/app/controllers/*.rb"].each{ |m| require m }
+Dir[DIST_ROOT+"/app/helpers/*.rb"].each { |m| require m }
+Dir[DIST_ROOT+"/app/models/*.rb"].each { |m| require m }
+Dir[DIST_ROOT+"/app/mailers/*.rb"].each { |m| require m }
+Dir[DIST_ROOT+"/lib/*/lib/*.rb"].each { |m| require m }
+Dir[DIST_ROOT+"/lib/*/bin/*.rb"].each { |m| require m }
+Dir[DIST_ROOT+"/plugins/*/init.rb"].each { |m| require m }
-# set your db info here
-ActiveRecord::Base.establish_connection(
- :adapter => 'mysql',
- :username => 'root',
- :password => 'xxxxx',
- :database => 'merb'
-)
+#Get Database Config
+puts "Connecting to database..."
+conn_options = YAML::load(Erubis::Eruby.new(IO.read("#{DIST_ROOT}/conf/database.yml")).result)
+ActiveRecord::Base.establish_connection conn_options["#{MERB_ENV}"]
+#Get Environment File
+require "#{DIST_ROOT}/conf/environments/#{MERB_ENV}"
+
# add your own ruby code here for app specific stuff. This file gets loaded
-# after the framework is loaded.
\ No newline at end of file
+# after the framework is loaded.