i'm trying set 2 environments site, 1 on development server, 1 on live one. , want dictate records db can seen on each server. i've created file in includes, development has @show = "dev"
, live has @show = "live"
i've included @ top of application layout on every page. in views, each database call want put conditions this:
- f = event.find(:all, :conditions => ["#{@show} = 1"])
but doesn't pick @show
being variable, uses explicitly or ignores it. there simple way or not work how expect to?
update
i've managed make work, have include file on each individual view rather on application layout... not ideal it's solution:
= render "includes/dev_live" - f = event.find(:all, :conditions => {@show => 1})
i think better off changing variables symbols i.e
@show = :dev @show = :live
then active record query become:
f = event.find(:all, :conditions => {@show => 1})
Comments
Post a Comment