Data dodania Pytanie
2017-01-17 23:01 Why is this switch statement not working? »
I have this code (1..50).each do |num| case num when num % 4 == 0, num % 6 == 0 puts 'Cluck' when num % 4 == 0 puts '...
(3) odpowiedzi
2017-01-17 20:01 Sequel + ADO + Puma is not threading queries »
We have a website running in Windows Server 2008 + SQLServer 2008 + Ruby + Sinatra + Sequel/Puma We've developed an API for our website. When the acc...
(1) odpowiedzi
2017-01-17 19:01 Rails app deployed using elastic beanstalk responds with "site can't be reached" »
I have built a rails app with the following stack: Puma (application server) 3.0 Ruby on Rails 5.0 Postgresql 9.5.3 I tried deploying this applica...
(0) odpowiedzi
2017-01-17 14:01 Stripe Request failed: payment required(402) »
I keep getting the above error when testing my server and i cant see why. I succesfully created a managed account previously then when i want to add ...
(1) odpowiedzi
2017-01-17 11:01 Create HTML visualization from Brat format »
I have a set of files <*.txt, *.ann> in brat format. Example: file.txt Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi varius s...
(0) odpowiedzi
2017-01-17 11:01 Extracting images from video in JRuby-1.7.13 »
I want to extract images from a m4v video sent from mobile to my rails server. These images will be later used for face recognization purposes. There ...
(0) odpowiedzi
2017-01-17 10:01 how to get god status in rails »
I have setup god and provided script file to load and it working as expected. i wanted to take status of that god process from my rails application. ...
(1) odpowiedzi
2017-01-17 07:01 Why does Brew's recommended installation use Ruby to call curl? »
In the Brew installation guide, it says to run the following: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/maste...
(1) odpowiedzi
2017-01-17 06:01 Rspec Controller test not passing »
My controller and my test file are bellow. controllers/reports_controller.rb: def index @reports = Report.all end specs/controllers/reports_...
(2) odpowiedzi
2017-01-17 03:01 How to randomly pick a set number of items from a string, space delimited? »
Given a string like below: string = "hotdog cat food pickle sock ring lock fist door" What would be the right way to randomly pick 4 items (separat...
(2) odpowiedzi
2017-01-17 02:01 paypal adaptive Authentication failed. API credentials are incorrect »
i'm testing the adaptive payment on sandbox mode. but i'm getting error=Authentication+failed.+API+credentials+are+incorrect so, i would like to kno...
(0) odpowiedzi
2017-01-16 21:01 Using Sinatra and Stripe for an iOS app »
I would like to use ruby+sinatra to create the server files needed to process charges, what are the steps to do this? It seems like a simple process...
(0) odpowiedzi
2017-01-16 16:01 How to add an identifier in a row if any cell for that row is changed in excel? »
Is there a way in excel to mark the rows with an identifier if any cell in that row is changed without using vb scripts and using a formula ? Such th...
(1) odpowiedzi
2017-01-16 15:01 Check if there is any file or directory matching pattern using ruby »
I want to check if pattern with wildcards, e.g. /var/data/**/*.xml is matching to any file or directory on the disk. Obviously I could use Dir.glob b...
(1) odpowiedzi
2017-01-16 14:01 How to merge values from empty rows using Ruby collection functions? »
I have a collection: a = [[1, "a"], [nil, "b"], [nil, "c"], [2, "a"], [nil, "b"]] [[1, "a"], [nil, "b"], [nil, "c"], [2, "a"], [nil, "b"]] ...
(3) odpowiedzi
2017-01-16 07:01 How to query for a list of associated records using Rails 4 + PostgreSQL? »
I have the following models: Question.rb has_many :answers end class Answer.rb belongs_to :question end What I want to do is get the most rece...
(1) odpowiedzi
2017-01-15 22:01 Creating placeholder tags for dynamic variables in Ruby »
I looking for a way to define a set of placeholder/merge tags or implement a DSL where a set of template tags used in a view file would be dynamically...
(2) odpowiedzi
2017-01-15 22:01 Ruby/Sinatra: Load additional code without restarting web app »
I want to build a plugin system for a web app I'm writing. I don't want to have to restart the application every time a plugin is added/removed/enable...
(0) odpowiedzi
2017-01-15 22:01 updating selectbox using ajax in rails »
I am trying to update a selectbox of a form using ajax after creating a record but I get the following error: ActionView::Template::Error (undefined ...
(1) odpowiedzi
2017-01-15 18:01 Error Transaction.new into Rails app trying to import CSV data »
I try to import a CSV file into my database in a Rails app. I follow this gist. Here is my code: # db/seeds.rb require 'csv' csv_text = File.read(R...
(1) odpowiedzi
2017-01-15 16:01 acts_as_followers and friendly_id gems not finding id »
Im using the acts_as_follower gem and friendly_id gem. Iv set up acts_as_follower and everything is working as it should, I am able to follow Profile...
(1) odpowiedzi
2017-01-15 16:01 rspec test fails code in rails controller »
In my application_controller.rb, i have a line of code as follows: def index CaseStatus.order(:application_source).pluck(:application_source).uniq! ...
(1) odpowiedzi
2017-01-15 03:01 Is there a way to silence Ruby's deprecation warning in 2.4.0? »
Since Ruby 2.4.0, there has been a deprecation warning for using certain features that have been deprecated. For example, Bignum, Fixnum, TRUE, and FA...
(1) odpowiedzi
2017-01-15 02:01 How to create a model helper for rails 4 »
I have been using parameterize to make friendly urls. Example: @article.title.parameterize. The problem is for a title like "I'm here" it results in "...
(2) odpowiedzi
2017-01-14 22:01 Naming Ruby methods »
Given a class: class Shell attr_reader :spiral def initialize spiral @spiral = spiral end def ????? # do stuff... end end some_sh...
(5) odpowiedzi
2017-01-14 19:01 Enumerator block execution order in Ruby »
In David Black's The Well-Grounded Rubyist I came across the following Ruby code about enumerators: e = Enumerator.new do |y| puts "Starting up t...
(4) odpowiedzi
2017-01-14 16:01 nginx server with Unicorn and Sinatra not logging crashes »
I have a server using Ruby, Sinatra, Unicorn and nginx. I experienced a crash recently, which re-producing the issue while running in Terminal, I can ...
(1) odpowiedzi
2017-01-14 14:01 whois-rb gem produces error: "Whois::ServerNotFound" »
I'm totally lost here. I was trying to set up the whois gem according to the documentation at https://whoisrb.org/. Unfortunately I'm always getting a...
(2) odpowiedzi
2017-01-14 01:01 How do I check if all the elements in my array occur no more than twice? »
I'm using Ruby 2.4. Let's say I have an array of strings (which are all just string-i-fied (is that a word?) integers ... ["1", "2", "5", "25", "5"]...
(10) odpowiedzi
2017-01-13 20:01 How to fix a "value too long for type character varying(255)" error »
I'm trying to save a file so that I can upload it to stripe using CarrierWave, but I'm getting the error: ERROR: value too long for type character va...
(1) odpowiedzi
2017-01-13 18:01 How to read a class's instance variable scope and visibility »
Why is it not possible to read a class's instance variable value if it was set within the class using the attr_accessor? Is it because the the insta...
(4) odpowiedzi
2017-01-13 18:01 Compare an array of hashes against each other, both ways »
Adding this because some folks didn't see what I was asking for, but I'm looking for the unique values in each array, as compared to the other array. ...
(1) odpowiedzi
2017-01-13 15:01 Why is Range#sum defined in Enumerable module? »
In Ruby 2.4 and for Integer Ranges, Range(Enumerable)#sum is optimized to return a result directly, without iterating over all elements. I don't und...
(1) odpowiedzi
2017-01-13 11:01 Rails Rspec integer equals string ("1" == 1) »
How, in rspec, do you compare the value of something while ignoring the type? Failure/Error: expect(variable).to eql model.id expected: 1234 ...
(2) odpowiedzi
2017-01-13 10:01 Can I mock the class name of an RSpec double? »
I have an RSpec test file where I have created a double that allows a method and returns a value. In my Ruby application code I have used the code ...
(1) odpowiedzi