Data dodania Pytanie
2017-08-09 22:08 Rails scope doesn't return correct data »
When I use scope which I prepared in model, rails returns incorrect data. My Model: class CurrencyRate < ActiveRecord::Base scope :eur_today,...
(1) odpowiedzi
2017-08-09 19:08 Is there a more efficient way of returning a hash value given array of keys if hash key/value is present? »
I have a method which accepts a hash, and I have an array of keys (ordered by preference) which I want to check the hash for and return the value of t...
(2) odpowiedzi
2017-08-09 19:08 Sinatra::Warden undefined method `authenticated?' for nil:NilClass »
I'm trying to use authentication for my Sinatra web application with Sinatra_warden module, but when I point to an authorized site, it says: NoMethod...
(1) odpowiedzi
2017-08-09 19:08 JSON to HTML in ruby »
I have some data that is being displayed in JSON format as shown below. I want to convert this JSON data into HTML table/format. Can someone tell me w...
(0) odpowiedzi
2017-08-09 18:08 Need guidance to use .map,.group,.pluck, etc. to make multi series line chart in ruby on rails app »
I'm trying to display a multi series line chart using chartkick in a Ruby on Rails app. The chart should display paper_types and the weightfor each...
(2) odpowiedzi
2017-08-09 13:08 Ruby on Rails - Seeding big data (over 2.7M) record to production database »
In my application I have a City model. I have a sql file that contains all the cities in the world (its over 2.7M) & I need to seed all of them to...
(3) odpowiedzi
2017-08-09 10:08 Rails - Use jsonb instead of associations. How to integrate it in nested forms? »
Say there's a users table with column 'other_details' as jsonb datatype. There are different types of users. other_details contain many details which ...
(0) odpowiedzi
2017-08-09 01:08 How to compare images and determine which has more content? »
Goal: I want to grab the best frame from an animated GIF and use it as a static preview image. I believe the best frame is one that shows the most con...
(2) odpowiedzi
2017-08-08 22:08 Using dynamic schema with postgres »
I have to decide how I want to implement dynamic schema. I will try to put some more description where my problem is. I use the postgres DB in lates...
(0) odpowiedzi
2017-08-08 20:08 ActiveRecord before-transaction callback »
Problem: I'm looking for an ActiveRecord (Rails 3.2) callback hook that will execute BEFORE a DB transaction has begun. If it doesn't exist (and I d...
(1) odpowiedzi
2017-08-08 18:08 How to draw card objects side by side vs stacked on top of each other in terminal »
I am making an OO twenty one game. I have a Card class and a Deck class, the deck is made up of card objects. When a player shows their hand I call th...
(1) odpowiedzi
2017-08-08 16:08 Ruby array += vs push »
I have an array of arrays and want to append elements to the sub-arrays. += does what I want, but I'd like to understand why push does not. Behavior ...
(2) odpowiedzi
2017-08-08 14:08 Get Country from tzInfo TimeZone? »
Given a tzInfo TimeZone object such as 'America/New_York' how can I get the associated country (countries?) that would use the time zone with this ide...
(2) odpowiedzi
2017-08-08 13:08 Algolia::AlgoliaProtocolError in rspec after gem upgrade »
I started receiving Algolia::AlgoliaProtocolError after upgrading from 1.17.0 to 1.19.1 Full stack trace is below. Failure/Error: @listing = Fact...
(1) odpowiedzi
2017-08-08 10:08 URL Signing with AWS Cloudfront - Ruby »
My main purpose is to sign the URL using AWS Cloudfront in Ruby I Have created a key pair at https://portal.aws.amazon.com/gp/aws/securityCredentials...
(0) odpowiedzi
2017-08-08 05:08 Is there a way to get rspec --bisect to work with jruby? »
I thought I'd try using rspec --bisect to figure out which combinations of tests caused a failure, but it turns out that this doesn't work with JRuby,...
(0) odpowiedzi
2017-08-08 02:08 RSpec transaction test persists changes to instance variable in before(:each) »
SO... I have a RSpec testing issue where I am attempting to configure a specific setup (without creating new data, but modifying instance data) and a...
(1) odpowiedzi
2017-08-07 22:08 Nesting a Ruby hash »
I have a method that selects all the rows from my table like this: smtp_status_raw = my_table.select(:message, :is_valid, :hostname).map { |h| h.valu...
(2) odpowiedzi
2017-08-07 18:08 Rails 5.1: retrieve records for nested association with includes »
I'm trying to implement includes in has_many / belongs_to association similar to this example: class Author < ApplicationRecord has_many :books,...
(1) odpowiedzi
2017-08-07 17:08 How to change layout content the same throughout all erb files »
I am new to using sinatra I have in my layout erb file a navbar that stays consistent through all my pages using yield At the same time I have this h...
(1) odpowiedzi
2017-08-07 16:08 How To test in rspec if file is deleted? »
I would like to know how to test in rspec is specific file is deleted. Here is code that I am testing def check_status filename = File.join('test'...
(1) odpowiedzi
2017-08-07 16:08 How to find the keys which has false values? »
I have this array: @import = [{"User"=>[9], "Project"=>false, "Task"=>false, "Date"=>"2017-08-11", "Time (Hours)"=>2.0, "Comment"=>...
(3) odpowiedzi
2017-08-07 15:08 Rails 4 bulk updating array of models »
I have an array of ActiveRecord model and I want to renumber one column and bulk update them. Code looks like this: rules = subject.email_rules.order...
(2) odpowiedzi
2017-08-07 14:08 delete files from Google Drive Service account with the google drive gem »
We created a synchronizer plugin for discourse and it should synchronize backups to the google drive service account. In order to keep the admin's goo...
(0) odpowiedzi
2017-08-06 20:08 How can I use Git to identify function changes across different revisions of a repository? »
I have a repository with a bunch of C files. Given the SHA hashes of two commits, <commit-sha-1> and <commit-sha-2>, I'd like to write ...
(2) odpowiedzi
2017-08-06 18:08 Rails: How to make recent blog posts appear first »
I'm creating a blog app with ruby on rails. I was able to allow a user to add posts, but on the top of the page, the posts that were created first app...
(3) odpowiedzi
2017-08-06 15:08 Ruby - CSV Import split data into different tables »
I'm trying to import a csv file with a rake task. The csv looks like this model,brand,type,engine,price,doors Corsa,Opel,cupe,1100,14500,2 Corsa,Opel...
(1) odpowiedzi
2017-08-06 15:08 InvalidURIError when useing httparty post method and get the some field through users »
InvalidURIError (bad URI(is not URI?): https://api.flightstats.com/flex/schedules/rest/v1/json/from/VNS/to/DEL/departing/2017/ ...
(1) odpowiedzi
2017-08-06 14:08 Run a ruby on rails job every night at a specific time »
I have a job like this : class LdapSyncJob < ApplicationJob queue_as :default require 'pp' def perform users = User.all users.each d...
(1) odpowiedzi
2017-08-06 04:08 Unicorn+Sinatra+Nginx | FATAL error adding listener »
I have a Sinatra application hosted using Nginx and Unicorn. it went down when I upgraded the operating system (Ubuntu 14.04.5 LTS) on the server, and...
(2) odpowiedzi
2017-08-05 23:08 Ruby: deleting object while looping over list with that object »
So I have multiple lists to keep track of objects in a 2D game, but if these objects go off screen I want to remove these objects so they are no longe...
(1) odpowiedzi
2017-08-05 17:08 .sum data from query »
I'm trying to .sum a field from the following query: def self.busqueda_general(params) query = select('venta.Id,venta.TOTAL') .distinct ...
(2) odpowiedzi
2017-08-05 15:08 Rails ActiveRecord::InvalidForeignKey in ArticlesController#destroy »
ActiveRecord::InvalidForeignKey in ArticlesController#destroy SQLite3::ConstraintException: FOREIGN KEY constraint failed: DELETE FROM "articles" WHE...
(2) odpowiedzi
2017-08-05 10:08 Rollback transaction on pressing create button and fetching the value field to insert it into the form_for »
ERROR Started POST "/products" for 127.0.0.1 at 2017-08-05 01:23:20 -0700 Processing by ProductsController#create as HTML Parameters: {"utf8"=>...
(2) odpowiedzi
2017-08-05 08:08 Java encryption/decryption to Ruby »
I have snippet of code in Java responsible for Encryption and Decryption and need to convert in Ruby. Before posting here I gone through 4 Link but no...
(2) odpowiedzi