Data dodania Pytanie
2017-12-05 12:12 How to write into Rspec output log file from rspec test case? »
I have Rspec test cases but I want write some data from variables into Rspec output file for further processing, so how to write into output file gene...
(1) odpowiedzi
2017-12-05 12:12 multi thread slower than single thread in ruby »
I am trying to benchmark the below code, the method Rate.rate_by_service, does some DB calls / processing and returns a value mutex = Mutex.new thr...
(1) odpowiedzi
2017-12-05 06:12 How to do a multi-line class attribute with slim-rails? »
Element needs a lot of class attributes but I don't want them to be chucked in one line, as the line length will be too long and it would require heav...
(1) odpowiedzi
2017-12-05 06:12 Dynamically adding ActiveRecord scopes »
I have many scopes that use date ranges to do something, e.g. clicks_between(start_date, end_date). I also have want to support adding in a school yea...
(1) odpowiedzi
2017-12-05 05:12 Undefined method for <variable>_cont in spree - Ruby on Rails »
I am trying to do a search in the spree backend in reviews listing page. But am getting undefined method error for the fields. Eg: undefined method t...
(2) odpowiedzi
2017-12-05 01:12 Assert if any of two strings are present »
I have a webpage with two different strings depending on time of the day - "Good day" or "Good night". Is there any way to do some sort of assert_con...
(2) odpowiedzi
2017-12-04 22:12 Active model Serializers not eager loading relationships »
I'm using the Bullet gem to see where there are n+1 queries in my application. It's telling me to eager load my association taggings when calling my ...
(1) odpowiedzi
2017-12-04 17:12 Adding a video url to an sms or mms using twilio »
I can add a youtube link to a new message's body like below and it will send the message, but adding the link to the media_url gives an mime type erro...
(2) odpowiedzi
2017-12-04 16:12 Check if array is an ordered subset »
I want to find out if an array is an ordered subset of another array: [1,2] is an ordered subset of [1,2,3] [1,3] is an ordered subset of [1,2,3] [2...
(3) odpowiedzi
2017-12-04 16:12 helps decipher string and sub-string only for experts »
I have the following text I have a decrypted mini manual which is quite limited but recently I decoded a very simile one that I have many problems whe...
(0) odpowiedzi
2017-12-04 12:12 Rubocop, Rails and Rspec »
I'm using this configuration in .rubocop.yml: # inherit_gem: # rubocop-rails: # - config/rails.yml require: rubocop-rspec AllCops: DisplayCop...
(0) odpowiedzi
2017-12-04 12:12 Test case is freezing my system »
I am trying to run one test case and it is freezing my system. I am not able to figure it out. It is not even giving me an error, just freezing my sys...
(1) odpowiedzi
2017-12-04 03:12 Ruby variable assigment for not evaluated lines »
Recently I found out that a non-evaluated line, in Ruby, still assigns nil to the variable. 2.3.4 (main):0 > defined? this_never_seen_variable_bef...
(1) odpowiedzi
2017-12-03 23:12 possible ways of splitting a string into n substrings »
I'm trying to write a method that would take 'abcd' as an input, and return: ["a b c d", "a b cd", "a bc d", "a bcd", "ab c d", "ab cd", "abc d", "ab...
(4) odpowiedzi
2017-12-03 22:12 Why is Ruby throwing a syntax error whenever I use the gem command? »
This is the first time I've attempted to work with Ruby. I wanted to install sass so I updated gem and attempt to install sass but was thrown an error...
(1) odpowiedzi
2017-12-03 21:12 display page in iframe »
post '/uploadZIP' do zipFile = params['zip'][:filename] if zipFile.end_with? '.zip' File.open(params['zip'][:filename], 'w') do |f| f.write(para...
(0) odpowiedzi
2017-12-03 06:12 open zip file using rubyzip »
def extract_zip(file, destination) FileUtils.mkdir_p(destination) Zip::ZipFile.open(file) do |zip_file| zip_file.each do |f| file_path = File....
(0) odpowiedzi
2017-12-03 05:12 Iterating through array gives full array of items at the end »
I am trying to iterate through a set of records. However, at the end of the iteration, rails displays the full array. <%= @portfolio_item.technolo...
(1) odpowiedzi
2017-12-02 22:12 How to display websites in iframe »
I am using ruby and sinatra. I need to create a website that allows the user to upload a zipfile of other websites and display all of them in multiple...
(0) odpowiedzi
2017-12-02 19:12 Devise gem registration model issue »
I have an age check for my users in which if they want to sign up for my app, they have to be a certain age. I am using the devise gem, but created a...
(1) odpowiedzi
2017-12-02 13:12 Cannot create FactoryGirl's factory for model »
I have this situation with legacy project. Suppose I have rails model: rails g model entity name:string In that model there is MAIN_ENTITY constan...
(1) odpowiedzi
2017-12-02 12:12 Does ruby support an enumerable map_cons method or its equivalent? »
Ruby has a handy function for enumerables called each_cons. Which "Iterates the given block for each array of consecutive elements." This is really...
(2) odpowiedzi
2017-12-02 10:12 How to reference the array push is being called upon? »
I'm trying to create an array, where the first element and the last element are the same. I would like to be able to do so without having to assign t...
(3) odpowiedzi
2017-12-02 10:12 Search within activeRecord relation ruby on rails »
This is my controller code @users = User.all Inside view I have a drop-down from which I select a user. I want to show details of that users before...
(2) odpowiedzi
2017-12-02 06:12 Ahoy Top Events By Hash Property »
I am trying to find the proper way to get the top 5 (by count) events in a database based on a particular property in the events ("value"). I am also ...
(0) odpowiedzi
2017-12-02 03:12 Mysql error on sql like operator rails »
I get an error Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right...
(1) odpowiedzi
2017-12-02 02:12 Ruby: open textfile and take lines as string arguments »
Here is my Code: if ARGV.length != 1 puts "We need exactly one parameter. The name of a file." exit; end filename = ARGV[0] puts "Going to o...
(1) odpowiedzi
2017-12-02 02:12 How to keep a Sinatra cookie value as an integer »
I set the cookie using an integer cookies[:which_link] ||= 0 It seems to convert it from an integer to a string, because there are no complaints. ...
(1) odpowiedzi
2017-12-02 00:12 Rails 3 serialized hash values saving but not persisting »
I have a model with a serialized text column. When I save and reload the record, the values seem to persist but when I query the record the values are...
(1) odpowiedzi
2017-12-01 21:12 Does Array#sample guarantee random order? »
Does it only guarantee a random subset, or also random order? Use case is generating a secret string with ('a'..'z').to_a.sample(8).join. I'd like to...
(3) odpowiedzi
2017-12-01 21:12 Ruby Savon - Parse XML string »
I have exhausted google on this subject and I just can't seem to get it right.. I have the following XML payload returned from Savon: <?xml ver...
(1) odpowiedzi
2017-12-01 14:12 Filtering by categories with rails »
I have 2 models Recipe and Category, they associated with has_and_belongs_to_many, now I need to filter recipes by categories, when user checks catego...
(1) odpowiedzi
2017-12-01 11:12 Ruby Selenium - find_elements if nil => Net::ReadTimeout »
Hi I got Net::ReadTimeout every time I use find_elements when there are no elements like this. A short example my Feature-file: (cucamber) Feature: R...
(2) odpowiedzi
2017-12-01 06:12 Rails ActiveSupport::Concern and method evaluation »
I have this application which uses Devise with current_user helper. When I create a module, current_user becomes nil after I mention an attribution to...
(1) odpowiedzi
2017-12-01 03:12 Post Request from client With Proper Headers Always return 401- UnAuthorized »
Am a newbie to ruby. I am trying to invoke a REST API from ruby code. I have tried the code with both as standalone ruby code and inside a application...
(0) odpowiedzi