ruby - How to access environment in datamapper migration -


i have padrino server application datamapper orm layer. have database migration, say:

migrate 1, :test       execute 'some query'   end end 

this migration run using command:

padrino rake dm:migrate -e <env> 

now problem need access env in query (not choose schema or datamapper automatically, specific functionality). tried debugging migration see if there variable stores value, no luck. there way?

as turns out, since using padrino, can directly use padrino.env inside up do..end or down do..end blocks:

migrate 1, :test       env = padrino.env     execute "some query #{env}"   end end 

although padrino specific, concept of environment. sure work other frameworks rails well.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -