Data dodania Pytanie
2017-04-22 21:04 Stopping counter with rails-timeago »
I am timing a task from the date with the gem rails-timeago. The count appears in the view and I use the following code for this: <% = Timeago_tag...
(1) odpowiedzi
2017-04-22 17:04 Rails carrierwave resize only one image »
i do multiple upload of images with carrierwave, also resize. For example, i've uploaded 10 images, and carrierwave has create 3 version of any image ...
(2) odpowiedzi
2017-04-22 16:04 How to invert a value on Ruby »
If you have a set of numbers in an array how can you invert them so that the positive ones are negative and the negative are then positive. I've trie...
(2) odpowiedzi
2017-04-22 12:04 Swap elements in array if the next is bigger then current »
I want change order in arr if the next element is bigger than current. Hot to modify the code, so it will be work? arr = [5, 22, 29, 39, 19, 51, 78,...
(3) odpowiedzi
2017-04-22 11:04 Hello everyone, my blog app with paperclip gem throws error while pushing it on heroku »
remote: ! remote: /app/tmp/buildpacks/f6d48d8a14fccbb19c0c0402fca224929d18e9ee042b3e204bc5992612e990d3b3a0fb1f9627b1a3bae11e9fa20dffc96e136bd734a2f3c...
(1) odpowiedzi
2017-04-22 07:04 mini-profiler is not working »
in the console of browser it shows error:- "NetworkError: 500 Internal Server Error - http://localhost:3000/mini-profiler-resources/includes.js?v=12b...
(0) odpowiedzi
2017-04-22 05:04 RSpec how to test an argument data type passed to a method »
I need to test the passed argument type is an integer. Here is my test spec: require 'ball_spin' RSpec.describe BallSpin do describe '#create_ball...
(2) odpowiedzi
2017-04-22 04:04 How to build an array of intervals out of other intervals »
Given the following array of intervals: today = Time.current.beginning_of_day tomorrow = Time.current.tomorrow.beginning_of_day availabilities = { ...
(4) odpowiedzi
2017-04-22 04:04 How do I know that a gem is compatible with a version of rails? »
I'm just getting started with ruby on rails and as I follow the tutorial, there isn't an explanation of how certain gems were gathered and placed in t...
(3) odpowiedzi
2017-04-21 23:04 EJS in rails production not compiling properly »
I have a rails app that uses EJS templates. It is running perfectly on development, but in production, it acts like the EJS processing step is skipped...
(0) odpowiedzi
2017-04-21 22:04 Rails advanced Active Record query »
I want to do an advanced Active Record query on my models through a join and count all the records. I don't know whether it's possible to do what I wa...
(2) odpowiedzi
2017-04-21 18:04 "NameError: wrong constant name" after upgrading Rails 3.2 to 4.2 »
I'm upgrading a Rails app from 3.2 to 4.2 and when running tests, I'm getting NameError: wrong constant name (that's the full error message, nothing s...
(2) odpowiedzi
2017-04-21 18:04 Rspec: testing model class method »
I am trying to test the model class method. here's how model looks like class Abc class Dbc < ActiveRecord::Base self.table_name = 'vSomeVie...
(1) odpowiedzi
2017-04-21 17:04 Are ActiveRecord's find_or_create* methods fundamentally flawed? »
There are a few methods: first_or_create_by, find_or_create_by, etc which work on the principle: talk to the database to try to find the stuff we wa...
(2) odpowiedzi
2017-04-21 16:04 Sorting a complex ruby hash works fine, but it's impossible to reverse, what can I do? »
I have a hash in ruby with a complex structure, like this: something = {} something[1488343493] = { :type => 'tag', :name => 'v1.2', :sha =>...
(4) odpowiedzi
2017-04-21 14:04 Rails: Allow one session to be :pinned at a time »
I'm working on pinning a session for a company to the top of a list. A company should be able to pin a single spark session to the top of their list...
(1) odpowiedzi
2017-04-21 12:04 How do I capture server-side errors on Capybara Feature JS Tests using a lazy loader? »
Versions: Rails 5.0.2 rspec 3.5.0 rspec-rails 3.5.1 capybara 2.12.1 (w/ chromedriver/selenium for JS tests) ruby 2.3.3 gitlab-ci Past (and desired...
(1) odpowiedzi
2017-04-21 09:04 Unpermitted parameter when trying to update record »
I have two models, ProjectCategory and ProjectQuestion. A ProjectCategory can have many questions related to it, and a ProjectQuestion can only have o...
(1) odpowiedzi
2017-04-21 01:04 Rails 4: Model Associations are not working »
My associations in Rails 4 are not working review.rb class Review < ActiveRecord::Base belongs_to :movie, :class_name => "Movie", :foreign_k...
(1) odpowiedzi
2017-04-21 01:04 I want to get the data from many to many table »
I want to get the data from many to many relationship table (Tag-Service-Category) like this below in tag/show.html.erb. class Tag < ActiveRecord:...
(1) odpowiedzi
2017-04-20 22:04 Argument validation error in rspec »
I am working on a project which built on ROR framework. Suppose there are two /lib files 1. lib_file1 2. lib_file2 lib_file1 :- doing some task prede...
(0) odpowiedzi
2017-04-20 21:04 RSpec pending groups/tests results in non-zero exit status »
I have a set of rspec groups + examples, with a few groups and examples marked pending using the pending: 'Some notes about why' approach to marking t...
(0) odpowiedzi
2017-04-20 19:04 Detect browser in Sinatra »
I need to know (on .rb/.haml level) if device is mobile or if browser is not supported. I don't want (or it won't work well for my need) to parse user...
(1) odpowiedzi
2017-04-20 18:04 Ruby: Safe-navigation operator, undefined method `call` »
I am trying to compare a number literal with the return value of a function that could return nil or a numeric. Consider this: def unreliable [nil,...
(2) odpowiedzi
2017-04-20 16:04 Make single ActiveRecord query through several associated models »
I have the following models and associations: class Organization has_many :buildings end class Building has_many :counters end class Counter ha...
(1) odpowiedzi
2017-04-20 13:04 ruby private class method helper »
Hi I am trying to create a helper for mass defining ruby methods as private class methods. In general one can define a method as a private class metho...
(3) odpowiedzi
2017-04-20 13:04 How to (easily) split string in Ruby with length and also delimiter »
I need to split a string in Ruby which has the following format: [{a:1,b:2,c:3,d:4},{a:5,b:6,c:7,d:8},{a:9,b:10,c:11,d:12},{a:13,b:14,c:15,d:16}] ...
(3) odpowiedzi
2017-04-20 10:04 Instances of a model belonging to the same model Rails »
I have planned to build a complex sidebar menu with several layers of nesting, which displays links to different types of pages. Hence the model clas...
(2) odpowiedzi
2017-04-19 23:04 Schedule an ActiveJob in Rails »
I'm doing a weather API which will get, process and save data from another API. In order to get the daily updates (request URL info, get the JSON/XML ...
(3) odpowiedzi
2017-04-19 22:04 How to return a JSON response from a before block »
I am writing a Sinatra-based API, and want to protect certain endpoints with an API key, validating the key before the route is processed. I understa...
(2) odpowiedzi
2017-04-19 17:04 Why does `.each` return nil when called on a lazy enum after `.select`? »
I have a snippet of code that goes like this: sent_messages = messages.lazy.reject { |m| message_is_spam?(m) } .each {...
(2) odpowiedzi
2017-04-19 16:04 ActiveRecord multiple where date range »
Is there a more ActiveRecord idiomatic way to find which records have a start_at or end_at within a certain date_range? (Basically, need to find the r...
(2) odpowiedzi
2017-04-19 12:04 Dropzone JS Unpermitted Parameters In Rails 4 »
I've been struggling with this issue all night. I'm trying to upload multiple "Photo" models with Dropzone.js with the paperclip attribute "attachment...
(1) odpowiedzi
2017-04-19 12:04 Rspec test view renders another partial »
I have a view: pugin/elements/_list Inside this view it renders a different partial given that conditions are met. I'm looking to test that the view ...
(0) odpowiedzi
2017-04-19 07:04 How do I make certain pages of my ruby on rails application inaccessible to one of my STI based Devise User model types? »
I want one pages of my ruby on rails web application inaccessible to one of my STI model types. I have two models typeA and typeB inheriting from User...
(2) odpowiedzi