Hello everyone, I would like to use attr_encrypted and to do this, I need to get my fixtures singing that song. I have this in my fixtures ... encrypted_email: <%= "#{Encryptor.encrypt(:value => ''my-zuv13RyHHZkAvxtiuMwx3w@public.gmane.org'', :key => ''some secret key'')}" %> YAML obviously doesn''t like the type of characters being produced by Encryptor.encrypt because I''m getting the error .... a YAML error occurred parsing /home/anthony/Development/websites/ruby/GMFT/trunk/test/fixtures/members.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Please have a look at http://www.yaml.org/faq.html Does anyone know how I can escape those chars nicely to play with fixtures. Wrapping the output in double quotes hasn''t worked as you can see. If anyone could help me out here, It''d be much appreciated Thank you -ants -- 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.
Walter Lee Davis
2011-Aug-13 12:53 UTC
Re: Problems with Loading Encrypted Data from Fixtures
On Aug 13, 2011, at 5:50 AM, Ants Pants wrote:> Hello everyone, > > I would like to use attr_encrypted and to do this, I need to get my > fixtures singing that song. > > I have this in my fixtures ... > > encrypted_email: <%= "#{Encryptor.encrypt(:value => > ''my-zuv13RyHHZkAvxtiuMwx3w@public.gmane.org'', :key => ''some secret key'')}" %>Have you tried running that command in irb or Rails c, and pasting the output into your YAML? Might be a useful test step. Walter> > YAML obviously doesn''t like the type of characters being produced by > Encryptor.encrypt because I''m getting the error .... > > a YAML error occurred parsing /home/anthony/Development/websites/ > ruby/GMFT/trunk/test/fixtures/members.yml. Please note that YAML > must be consistently indented using spaces. Tabs are not allowed. > Please have a look at http://www.yaml.org/faq.html > > Does anyone know how I can escape those chars nicely to play with > fixtures. Wrapping the output in double quotes hasn''t worked as you > can see. > > If anyone could help me out here, It''d be much appreciated > > Thank you > > -ants > > > > -- > 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 > . > 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.
Frederick Cheung
2011-Aug-13 18:07 UTC
Re: Problems with Loading Encrypted Data from Fixtures
On Aug 13, 10:50 am, Ants Pants <antsmailingl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello everyone, > > I would like to use attr_encrypted and to do this, I need to get my fixtures > singing that song. > > I have this in my fixtures ... > > encrypted_email: <%= "#{Encryptor.encrypt(:value => ''...@email.com'', :key => > ''some secret key'')}" %> > > YAML obviously doesn''t like the type of characters being produced > by Encryptor.encrypt because I''m getting the error .... > > a YAML error occurred parsing > /home/anthony/Development/websites/ruby/GMFT/trunk/test/fixtures/members.ym l. > Please note that YAML must be consistently indented using spaces. Tabs are > not allowed. Please have a look athttp://www.yaml.org/faq.html > > Does anyone know how I can escape those chars nicely to play with fixtures. > Wrapping the output in double quotes hasn''t worked as you can see. >You haven''t actually wrapped the output in double quotes - when erb evaluates your <%= then those quotes on the inside go. ''<%= ... %>'' might do the trick. You should also escape any '' or \ inside your output. Fred> If anyone could help me out here, It''d be much appreciated > > Thank you > > -ants-- 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.
Ants Pants
2011-Aug-16 07:03 UTC
Re: Re: Problems with Loading Encrypted Data from Fixtures
Thanks for your replies. I haven''t used ERB for ages and so forgot the syntax. I think I''m going to have to shelve encrypting the email address as it doesn''t play with Authlogic and I haven''t seen a way of encrypting the email address with Authlogic. I will look into this later, though. Thanks again for the replies. -ants On 13 August 2011 20:07, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> > > On Aug 13, 10:50 am, Ants Pants <antsmailingl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hello everyone, > > > > I would like to use attr_encrypted and to do this, I need to get my > fixtures > > singing that song. > > > > I have this in my fixtures ... > > > > encrypted_email: <%= "#{Encryptor.encrypt(:value => ''...@email.com'', > :key => > > ''some secret key'')}" %> > > > > YAML obviously doesn''t like the type of characters being produced > > by Encryptor.encrypt because I''m getting the error .... > > > > a YAML error occurred parsing > > > /home/anthony/Development/websites/ruby/GMFT/trunk/test/fixtures/members.ym > l. > > Please note that YAML must be consistently indented using spaces. Tabs > are > > not allowed. Please have a look athttp://www.yaml.org/faq.html > > > > Does anyone know how I can escape those chars nicely to play with > fixtures. > > Wrapping the output in double quotes hasn''t worked as you can see. > > > > > You haven''t actually wrapped the output in double quotes - when erb > evaluates your <%= then those quotes on the inside go. > ''<%= ... %>'' > might do the trick. You should also escape any '' or \ inside your > output. > > Fred > > > If anyone could help me out here, It''d be much appreciated > > > > Thank you > > > > -ants > > -- > 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. > >-- 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.