ruby-1.9.2

How to set SameSite attribute to 'None; Secure' in Rails3.1.12 and Ruby1.9.3

可紊 提交于 2020-04-07 04:13:12
问题 A cookie associated with a cross-site resource at https://example.com/ was set without the SameSite attribute. It has been blocked, as Chrome now only delivers cookies with cross-site requests if they are set with SameSite=None and Secure . You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032. Please let me know how to set the SameSite

Ruby 1.9 + Net::FTP => Encoding::UndefinedConversionError

橙三吉。 提交于 2020-01-15 11:25:08
问题 i upgraded from Ruby 1.8.7 to 1.9.2 (and Rails 3.2.2) and have the problem that Net::FTP#gettextfile is throwing an Encoding::UndefinedConversionError I'm trying to download a xml file which is encoded as utf-8. The dowload works fine if i use getbinaryfile, but i would like to understand why gettextfile is not working. # -*- encoding : utf-8 -*- # working ftp = Net::FTP.open(host,user,password) ftp.passive = true ftp.getbinaryfile("some.xml","tmp/some.xml") # not working ftp = Net::FTP.open

Neither ruby and nor irb can load .rb file in current directory

依然范特西╮ 提交于 2019-12-31 08:44:16
问题 I'm having a really noob problem with importing files in Ruby. I'm making a Ruby app in Windows XP. All the class files for the app are in "C:/Documents/Prgm/Surveyor_Ruby/lib" . But when I require a file in another file, neither ruby nor irb can find the required file. The current directory's contents: C:\Documents\Prgm\Surveyor_Ruby\lib>dir Volume in drive C has no label. Volume Serial Number is AAAA-BBBB Directory of C:\Documents\Prgm\Surveyor_Ruby\lib 10/09/2010 06:32 PM <DIR> . 10/09

What zip library works well with Ruby 1.9.2?

∥☆過路亽.° 提交于 2019-12-31 03:35:25
问题 I used the rubyzip gem in Ruby 1.8.7 before, but I heard rubyzip doesn't work well with ruby 1.9.2. What zip libraries work well with Ruby 1.9.2? 回答1: Have you actually tried using rubyzip with 1.9.2? Seems to work fine for me: >> RUBY_VERSION #=> "1.9.2" >> require 'zip/zip' #=> true >> Zip::ZipFile.foreach(File.expand_path("~/Downloads/Archive.zip")) { |f| p f } #=> [bartxt, footxt] bar.txt foo.txt 回答2: I used rubyzip gem in Ruby 1.8.7 also. For Ruby 1.9.x you need to use version 0.9.5 or

ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT)

时间秒杀一切 提交于 2019-12-28 05:52:06
问题 I am using Ruby 1.9.2, Rails 3.0.4/3.0.5 and Phusion Passenger 3.0.3/3.0.4. My templates are written in HAML and I am using the MySQL2 gem. I have a controller action that when passed a parameter that has a special character, like an umlaut, gives me the following error: ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT) The error points to the first line of my HAML template, which has the following code on it: <!DOCTYPE html> My understanding is that this is

ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT)

安稳与你 提交于 2019-12-28 05:52:03
问题 I am using Ruby 1.9.2, Rails 3.0.4/3.0.5 and Phusion Passenger 3.0.3/3.0.4. My templates are written in HAML and I am using the MySQL2 gem. I have a controller action that when passed a parameter that has a special character, like an umlaut, gives me the following error: ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT) The error points to the first line of my HAML template, which has the following code on it: <!DOCTYPE html> My understanding is that this is

Simple XOR ruby 1.9.2

人盡茶涼 提交于 2019-12-24 07:05:32
问题 Apparently this used to work on ruby 1.8.7 but unfortunately not on 1.9.2 class String def xor(key) text = dup text.length.times {|n| text[n] ^= key[n.modulo key.size] } text end end def encode(_original, _pass = 'testvendor') _original.xor(_pass) end puts encode('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

“uninitialized constant Encoding” using rvm, ruby 1.9.2, bundler and passenger

大城市里の小女人 提交于 2019-12-23 11:45:12
问题 I am at wit's end here and am turning to you all for some help on this f*#$^ encoding issue. I am running on a private server with root permissions on Dreamhost. Here is a bit about my environment and versions. $ `which ruby` -v ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux] $ `which bundle` -v Bundler version 1.0.15 $ `which rails` -v Rails 3.0.9 Aside from this error, my rails app runs fine without issue. However, when I try to change the encoding a string by using the encode

“uninitialized constant Encoding” using rvm, ruby 1.9.2, bundler and passenger

蓝咒 提交于 2019-12-23 11:45:04
问题 I am at wit's end here and am turning to you all for some help on this f*#$^ encoding issue. I am running on a private server with root permissions on Dreamhost. Here is a bit about my environment and versions. $ `which ruby` -v ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux] $ `which bundle` -v Bundler version 1.0.15 $ `which rails` -v Rails 3.0.9 Aside from this error, my rails app runs fine without issue. However, when I try to change the encoding a string by using the encode

Regular Expressions with lookahead in Ruby

拟墨画扇 提交于 2019-12-23 01:28:11
问题 My current regex battle is replacing all commas before a number in a string. The regex must then ignore all following commas. I've been screwing around on rubular for about an hour and can't quite seem to get something working. Test String... 'this is, a , sentence33 Here, is another.' Desired Output... 'this is comma a comma sentence33 Here, is another.' So something along the lines of... testString.gsub(/\,*\d\d/,"comma") To give you some background, I'm doing a little scraping sideproject.