On 4:
http://api.rubyonrails.org/classes/ActiveRecord/Migration.html#label-Reversible+Migrations
Looks like you just define the up, AR takes care of the rest. Never
tried it, it'll save a few lines of code though.
On injection, AR sanitizes almost everything I believe. The only thing
I know to a
Thanks Nokan, Dave, Philippe for your replies, it's good to get a
measure of standard practice even for things as simple as this.
There just remains no. 4 (from a question by Isak Andersson
http://comments.gmane.org/gmane.comp.lang.ruby.camping.general/1751)
for which I'd like an opinion, si
I personally always use a config/database.yml file as I like to keep the
configuration out of the code.
Plus it makes it easier to switch between development and production
configuration.
E.g. for Heroku:
dbconfig = YAML.load(File.read('config/database.yml'))
# On Heroku the pro
Hi,
Just a comment: I don't think it's a good practice to set the database
details (establish_connection() call) in the application itself. It's an
environmental issue, and this way you lose the possibility to move
your app between dev, ((devtest)), (test) and production environments
without mod
1) I usually do 1.3:
def self.connect env
App::Models::Base.establish_connection App.config[env]['db_connection']
App::Models::Base.logger = Logger.new File.dirname(__FILE__) +
App.config[env]['db_log']
end
def self.create env = 'dev'
self.connect env
self.create_schema
end
2) I've never
I know this isn't Python, but I'd like to get a view on the 'one
obvious' way to set up an SQLite (or other) database and its location
per-app. I've got a bit lost with the Camping 2 changes and various
code snippets I have kicking around.
1.
is it best to set up the DB creation/connection:
6 matches
Mail list logo