ruby-2.2

Celluloid async inside ruby blocks does not work

一笑奈何 提交于 2019-12-03 16:16:23
问题 Trying to implement Celluloid async on my working example seem to exhibit weird behavior. here my code looks class Indefinite include Celluloid def run! loop do [1].each do |i| async.on_background end end end def on_background puts "Running in background" end end Indefinite.new.run! but when I run the above code, I never see the puts " Running in Background " But, if I put a sleep the code seem to work. class Indefinite include Celluloid def run! loop do [1].each do |i| async.on_background

Celluloid async inside ruby blocks does not work

自古美人都是妖i 提交于 2019-12-03 05:33:19
Trying to implement Celluloid async on my working example seem to exhibit weird behavior. here my code looks class Indefinite include Celluloid def run! loop do [1].each do |i| async.on_background end end end def on_background puts "Running in background" end end Indefinite.new.run! but when I run the above code, I never see the puts " Running in Background " But, if I put a sleep the code seem to work. class Indefinite include Celluloid def run! loop do [1].each do |i| async.on_background end sleep 0.5 end end def on_background puts "Running in background" end end Indefinite.new.run! Any idea

Assets pipeline doesn't work in 'application.scss' in my Rails 4.2 app

点点圈 提交于 2019-12-02 16:09:45
问题 I'm new in Rails and apologize if that is a stupid question. But i cannot resolve my problem: I added Bootstrap to my new app but it still doesn't use any new styles. I've renamed application.css to application.scss and created such structure: |-stylesheets |-elements |--articles |---article.scss |-application.scss Application.scss /* User styles * Plugins first */ @import "bootstrap-sprockets"; @import "bootstrap"; @import "elements/**/*"; /* * This is a manifest file that'll be compiled

Assets pipeline doesn't work in 'application.scss' in my Rails 4.2 app

怎甘沉沦 提交于 2019-12-02 08:36:32
I'm new in Rails and apologize if that is a stupid question. But i cannot resolve my problem: I added Bootstrap to my new app but it still doesn't use any new styles. I've renamed application.css to application.scss and created such structure: |-stylesheets |-elements |--articles |---article.scss |-application.scss Application.scss /* User styles * Plugins first */ @import "bootstrap-sprockets"; @import "bootstrap"; @import "elements/**/*"; /* * This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. * * Any CSS and SCSS file within

Why are parenthesis sometimes required in Ruby?

£可爱£侵袭症+ 提交于 2019-12-01 21:52:49
问题 I recently ran into an oddity while looking at some Ruby code from the Rails docs. Ruby lets you pass arguments like these examples: redirect_to post_url(@post), alert: "Watch it, mister!" redirect_to({ action: 'atom' }, alert: "Something serious happened") But that second case looked odd to me. It seems like you should be able to pass it like so: redirect_to { action: 'atom' }, alert: "Something serious happened" And it would have the same meaning with or without parenthesis. But instead you

Why are parenthesis sometimes required in Ruby?

时光毁灭记忆、已成空白 提交于 2019-12-01 21:28:28
I recently ran into an oddity while looking at some Ruby code from the Rails docs . Ruby lets you pass arguments like these examples: redirect_to post_url(@post), alert: "Watch it, mister!" redirect_to({ action: 'atom' }, alert: "Something serious happened") But that second case looked odd to me. It seems like you should be able to pass it like so: redirect_to { action: 'atom' }, alert: "Something serious happened" And it would have the same meaning with or without parenthesis. But instead you get: syntax error, unexpected ':', expecting '}' Referring to the colon after action . I'm not sure

AWS Elastic Beanstalk - How To Upgrade Existing Environment from Ruby 2.1 to Ruby 2.2

时光怂恿深爱的人放手 提交于 2019-11-30 06:24:55
问题 AWS Elastic Beanstalk - Cannot Clone With Latest Platform or eb upgrade from Ruby 2.1 to Ruby 2.2 I've been smashing my head on this one. Back in May, AWS announced that their Ruby Elastic Environments now offer Ruby-2.2 (e.g. ruby-2.2-(passenger-standalone) or ruby-2.2-(puma) ). I can't upgrade my existing ruby-2.1 environments to ruby-2.2. It appears I have to recreate them completely...that seems silly? Anyone else out there experiencing this? Am I just missing something simple? Extra

Keyword arguments unpacking (splat) in Ruby

白昼怎懂夜的黑 提交于 2019-11-29 09:59:01
What is happening below seems a little strange to me. def f(a, b) puts "#{a} :: #{b}" end f(*[1, 2], **{}) # prints "1 :: 2" hash = {} f(*[1, 2], **hash) ArgumentError: wrong number of arguments (3 for 2) f(*[1, 2], **Hash.new) ArgumentError: wrong number of arguments (3 for 2) Is this a compiler optimization feature? That is a Ruby's bug that has been reported several times (for example here by me) but has not been fixed. I guess that since the keyword argument feature has been introduced, the double splat syntax has become murky, and that is the indirect cause of this bug. I heard that Matz

rails server cannot start; getaddrinfo: nodename nor servname provided, or not known (SocketError)

旧巷老猫 提交于 2019-11-29 02:37:25
I have not found a solution to the problem, however someone did already ask about the same problem a few days ago - ( Rails Server Keeps Exiting (SocketError) ) After I start a rails server the system returns some error I cannot understand. To install Ruby on Rails on my mac I did everything as listed on http://railsapps.github.io/installrubyonrails-mac.html here is my terminal response: $ rails server => Booting WEBrick => Rails 4.2.0 application starting in development on http://localhost:3000 => Run `rails server -h` for more startup options => Ctrl-C to shutdown server [2015-02-28 02:14:46

AWS Elastic Beanstalk - How To Upgrade Existing Environment from Ruby 2.1 to Ruby 2.2

梦想与她 提交于 2019-11-28 18:17:14
AWS Elastic Beanstalk - Cannot Clone With Latest Platform or eb upgrade from Ruby 2.1 to Ruby 2.2 I've been smashing my head on this one. Back in May, AWS announced that their Ruby Elastic Environments now offer Ruby-2.2 (e.g. ruby-2.2-(passenger-standalone) or ruby-2.2-(puma) ). I can't upgrade my existing ruby-2.1 environments to ruby-2.2. It appears I have to recreate them completely...that seems silly? Anyone else out there experiencing this? Am I just missing something simple? Extra Information I've been gleefully using ruby-2.1-(passenger-standalone) for several months in my staging and