I have a yml file with ip info. When I try to do " host: Site[''name''] [''ip''] it is getting interpreted directly and it is saying Bad URI: Site[''name''][''ip''] How do I get the database yml to interpret the Site constant? I can see the hash in the console. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
anyone? On Jun 14, 12:50 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have aymlfile with ip info. When I try to do "host: Site[''name''] > [''ip''] it is getting interpreted directly and it is saying Bad URI: > Site[''name''][''ip''] > > How do I get thedatabase ymlto interpret the Site constant? I can > see the hash in the console.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jun 14, 6:50 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a yml file with ip info. When I try to do " host: Site[''name''] > [''ip''] it is getting interpreted directly and it is saying Bad URI: > Site[''name''][''ip''] > > How do I get the database yml to interpret the Site constant? I can > see the hash in the console.database.yml is passed through erb Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ok, in my load_config I do this: Site = YAML.load_file(File.join(RAILS_ROOT, ''config'', ''sites.yml'')) Something like this in the database.yml? host: <%= Site[''name''][''db''] %> On Wed, Jun 16, 2010 at 03:26, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> > > On Jun 14, 6:50 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I have a yml file with ip info. When I try to do " host: Site[''name''] > > [''ip''] it is getting interpreted directly and it is saying Bad URI: > > Site[''name''][''ip''] > > > > How do I get the database yml to interpret the Site constant? I can > > see the hash in the console. > > database.yml is passed through erb > > Fred > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
YAML.load(ERB.new(File.read(path_to_file)).result) On Jun 16, 6:14 pm, Chris Habgood <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ok, in my load_config I do this: > > Site = YAML.load_file(File.join(RAILS_ROOT, ''config'', ''sites.yml'')) > > Something like this in the database.yml? > > host: <%= Site[''name''][''db''] %> > > On Wed, Jun 16, 2010 at 03:26, Frederick Cheung > <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > > > > > > > On Jun 14, 6:50 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I have a yml file with ip info. When I try to do " host: Site[''name''] > > > [''ip''] it is getting interpreted directly and it is saying Bad URI: > > > Site[''name''][''ip''] > > > > How do I get the database yml to interpret the Site constant? I can > > > see the hash in the console. > > > database.yml is passed through erb > > > Fred > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscrib e@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-talk?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Is this correct? <% Site = YAML.load(ERB.new(File.read(File.join(RAILS_ROOT, ''config'', ''sites.yml''))).result) %> On Thu, Jun 17, 2010 at 00:27, trybeee <trybeee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> YAML.load(ERB.new(File.read(path_to_file)).result) > > On Jun 16, 6:14 pm, Chris Habgood <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Ok, in my load_config I do this: > > > > Site = YAML.load_file(File.join(RAILS_ROOT, ''config'', ''sites.yml'')) > > > > Something like this in the database.yml? > > > > host: <%= Site[''name''][''db''] %> > > > > On Wed, Jun 16, 2010 at 03:26, Frederick Cheung > > <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: > > > > > > > > > > > > > On Jun 14, 6:50 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I have a yml file with ip info. When I try to do " host: > Site[''name''] > > > > [''ip''] it is getting interpreted directly and it is saying Bad URI: > > > > Site[''name''][''ip''] > > > > > > How do I get the database yml to interpret the Site constant? I can > > > > see the hash in the console. > > > > > database.yml is passed through erb > > > > > Fred > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Ruby on Rails: Talk" group. > > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > . > > > To unsubscribe from this group, send email to > > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org><rubyonrails-talk%2Bunsubscrib > e@googlegroups.com> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.