Data dodania Pytanie
2017-08-05 05:08 Algorithm - longest wiggle subsequence »
Algorithm: A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive ...
(4) odpowiedzi
2017-08-05 03:08 Override the global index_errors option »
I have configured application.rb with the following option to add an index to errors on nested models: config.active_record.index_nested_attribute_er...
(1) odpowiedzi
2017-08-04 17:08 Showing random Product images from same category as the selected product is in. ROR app »
I'm modifying a Rails app I've been working on. I installed a model images.rb to handle all images for products. When the user has selected a produc...
(1) odpowiedzi
2017-08-04 17:08 "comparison of Date with ActiveSupport::TimeWithZone" fails consistently after about two months in prod »
In a production app, the following code works in dev and (initially) in production: @employee.ident_expiration_date && @employee.ident_expira...
(0) odpowiedzi
2017-08-04 16:08 Install chromedriver using a remote host »
I deployed my application using Ruby, Sinatra and Redis DataBase, on my ubuntu remote host named Scaleway. In this way, i've install all what i need,...
(1) odpowiedzi
2017-08-04 16:08 install ice on by brew error »
Install Ice by Homebrew,and i got some errors as follows: ➜ ~ brew install zeroc-ice/tap/ice Tapping zeroc-ice/tap Cloning into '/usr/local/Home...
(1) odpowiedzi
2017-08-04 16:08 How to redirect a URI with a parenthesis in Ruby on Rails »
I'm trying to do a redirect in Rails 4 get '/something)', to: redirect("/something", status: 301), format: false This doesn't work because parenth...
(1) odpowiedzi
2017-08-04 15:08 Second regex match statement get an error in Ruby »
While this code run perfectly: def center2 (a) c = a.match('(?<=A).*$') return c end Why this code got an error: def center2 (a) b = a.ma...
(2) odpowiedzi
2017-08-04 15:08 Given a Rails 5 has_and_belongs_to_many, how to create a join record? »
I have the following schema: class Industry << ApplicationRecord has_and_belongs_to_many :departments end # Relationship table: departments_...
(1) odpowiedzi
2017-08-04 13:08 Why using POST method in a form returns Error 404? »
I am completely newbie in ruby, so I made a form with POST http method, but it fails as follows: ruby sinatra_msg.rb [2017-08-04 07:47:50] INFO WE...
(1) odpowiedzi
2017-08-04 13:08 Getting a NameError (undefined local variable or method `“_”') »
I am trying to initialize a collection through c = Collection.new(name: current_user.account.name + "_" + @form.form_name, description: @form.form_n...
(1) odpowiedzi
2017-08-04 05:08 How to select rows covering today's day and month in pg / Rails »
So I have this table called SeasonRate create_table "season_rates", force: :cascade do |t| t.string "title" t.datetime "from_date" t.datetime...
(1) odpowiedzi
2017-08-04 04:08 How to track the User Activity in Ruby on Rails »
Is there any Gem or Method, which tracks the user behaviour on the site like whether the user has made the purchase of the site by landing on the doma...
(1) odpowiedzi
2017-08-03 20:08 Rails 3 to Rails 5 migration ActiveRecord issue »
Rails upgrade from 2.3.8 to 5.1.2 with Jruby ActiveRecord issue when upgrading gem 'activerecord-jdbc-adapter' I started to work as a junior Rails d...
(0) odpowiedzi
2017-08-03 20:08 How do I run a calculation in my ruby on rails model before the view is rendered? »
I have an application where users complete a number of tests. The results of these tests is then stored in the database. class TestOne < ActiveRec...
(1) odpowiedzi
2017-08-03 19:08 Displaying multiple paperclip images from database in ROR app. many relations »
I'm very new to ROR and I'm building an ROR app where each product can have many images. Im using paperclipfor the image upload. To do that I added ...
(1) odpowiedzi
2017-08-03 19:08 rspec How to test if my yield is called »
I need to test that my method is yielding correctly, the implementation is something like def method(val) @attr = yield(val) end I wrote my tes...
(1) odpowiedzi
2017-08-03 17:08 Rspec is calling the original method instead of the mock »
I have an issue with rspec whereby an external object is created from within a method, and instead of using the mock of that object, the actual object...
(0) odpowiedzi
2017-08-03 12:08 syntax error, unexpected '}', expecting keyword_end } »
I am new to Ruby, I don't quite get what is happening here, This code works chrome = Watir::Browser.new:chrome firefox = Watir::Browser.new:firefox...
(4) odpowiedzi
2017-08-03 05:08 Ruby method unable to pass Rspec test »
I am trying to create a method that takes in a user input. It turns that user input into an integer, it then subtracts one from the user input. It als...
(2) odpowiedzi
2017-08-03 05:08 add attribute to .create in rails »
Lets say im saving an array into my model. Is there any way to add an attribute to it? I am running Property.create(property_params) to save the inst...
(2) odpowiedzi
2017-08-03 04:08 performing activejob in rails with action cable »
i just wanna using rails active job to make a queue job for my actioncable channel, but unfortunately it doesn't work :( this is my activejob rails s...
(0) odpowiedzi
2017-08-03 02:08 Ruby NoMethodError: undefined method `messages' for []:Array »
Since google did not help me in my quest to figure this out, I figured I would share it for anyone else that runs into this problem: When attempting ...
(1) odpowiedzi
2017-08-03 01:08 Rails 5.1 mailer wrong number of arguments given 0 expected 2 »
I'm working on a Rails 5.1.2 app in Ruby 2.4.1. I'm creating a simple mailer to use as seen below in the class: class PagingMailer < Applicatio...
(1) odpowiedzi
2017-08-02 21:08 Testing number of successfully returned threads using rspec »
How can I test that the number of successfully returned threads to the main thread is equal to the number of threads created in rspec? ...
(0) odpowiedzi
2017-08-02 20:08 Rails 4 parameters; how to whitelist a param to a set of values »
I have already read some posts, such as Value whitelist using strong parameters in Rails 4, but it's not quite what I need. I have a controller which...
(2) odpowiedzi
2017-08-02 18:08 Why is ruby returning `true` for method call? »
So this is a brief tutorial I found abouot Rspec: w3ii.com: rspec on it's explanation about rspec helpers. This is the code for the example: class Do...
(2) odpowiedzi
2017-08-02 17:08 Ruby on Rails - Read Cookie value after page load »
In my application in one of my views, I add a Cookie from my Controller and based on this Cookie, I set a value to my variable (which will be used in ...
(1) odpowiedzi
2017-08-02 15:08 Update attribute at sign in with devise (after_set_user callback) »
I have the devise gem installed on my rails app. Also I have a boolean column:is_active in the stores table. Each time a store tries to sign in I'm r...
(0) odpowiedzi
2017-08-02 12:08 saving boolean values to postgres database using ruby on rails »
I've been working on a old rails project for a bit now. Since I haven't worked with rails in some time I'm a bit rusty and need some help along the wa...
(1) odpowiedzi
2017-08-02 12:08 Ruby Returning unexpected nil »
I have a RSpec problem. According to that problem I have written a solution in ruby. But when running with RSpec Where I expect to get a value, I am g...
(1) odpowiedzi
2017-08-02 12:08 Unable to create a user using a custom form using devise in ruby on rails »
Im having a problem creating a devise user using a custom form. Whenever I submit the form I get an error saying the email and password fields cant be...
(0) odpowiedzi
2017-08-02 11:08 How to deploy a Ruby app on Heroku using Sinatra and Watir gem »
Hi i've some trouble to deploy my Ruby application on Heroku using Sinatra and Watir gem. I have to load a chrome window, that's why i read the messag...
(1) odpowiedzi
2017-08-01 23:08 Ruby 2.4 documentation for this bracket syntax »
Have not used Ruby in quite sometime and ran into some unfamiliar syntax: class AddQuantityToLineItems < ActiveRecord::Migration[5.1] The [5.1] ...
(1) odpowiedzi
2017-08-01 21:08 ACTIVE RECORD REGULAR EXPRESSION »
I need to know how use regular expression with active record. I need to create a custom validation where the phone can not have less than 10 digits w...
(1) odpowiedzi