Tuesday, 15 June 2010

Rails Application Templates: How to override lines already presents in environment files? -



Rails Application Templates: How to override lines already presents in environment files? -

rails application templates great setup base of operations project.

but when i'm using "environment" directive, add together default configuration, doesn't override existing settings.

for example, if set line in app template :

environment 'config.action_mailer.raise_delivery_errors = true', env: 'development'

it's added @ top of config/environments/development.rb file. doesn't override existing line below

config.action_mailer.raise_delivery_errors = false

is there way override existing lines ? (or @ to the lowest degree directive delete line matching pattern)

since rails application template generator based on thor, it's possible utilize gsub_file remove part of file. in case:

gsub_file('config/environments/development.rb', /config\.action_mailer\.raise_delivery_errors.*/, '')

ruby-on-rails ruby-on-rails-3

No comments:

Post a Comment