Data dodania Pytanie
2017-04-11 14:04 SSL with a legacy rails project »
I'm trying to add SSL to a legacy rails project (rails 2.3.15, ruby 1.8.7). I'm a little out of my comfort zone in all honesty as a very junior java d...
(0) odpowiedzi
2017-04-11 10:04 Rails STI associations and nested attributes »
I have a structure like the following: class Order < ApplicationRecord end class BulkOrder < Order has_many :vehicles, inverse_of: :order ...
(1) odpowiedzi
2017-04-11 08:04 How to set up Token Authentication properly in Rails? »
I am trying to make an API for a project. I followed instructions from this video - https://www.youtube.com/watch?v=lgdUqtw4weg&t=165s Basically ...
(1) odpowiedzi
2017-04-11 08:04 Rails Devise - Update User with Associated Model »
Good day, I have a devise users model and in edit user page I want to add a custom field called "add verification documents" which takes in multiple ...
(0) odpowiedzi
2017-04-11 05:04 How to read mixed POST types with sinatra »
I am having similar issue to this one In my case I am sending 'mixed' content using: ... $.ajax({ type: 'POST', url: '/create_product', ...
(0) odpowiedzi
2017-04-11 02:04 Only use value in method when value is available in Rails 5 »
I am using the aslsx gem in Rails to generate Excel files. In my template I have: wb = xlsx_package.workbook wb.add_worksheet(name: "Buttons") do |s...
(3) odpowiedzi
2017-04-10 20:04 how to rescue specific exceptions in rails »
I am executing a sql function and capturing standard error. is it the right way? if not how can i catch specific exception? query = ActionControl...
(1) odpowiedzi
2017-04-10 19:04 Find all indices of a substring within a string »
I want to be able to find the index of all occurrences of a substring in a larger string using Ruby. E.g.: all "in" in "Einstein" str = "Einstein" st...
(3) odpowiedzi
2017-04-10 19:04 Test-first-ruby 13_xml_document »
I am working on test-first-ruby-master (you can find it at https://github.com/appacademy/test-first-ruby). The 13_xml_document_spec.rb is the Rspec t...
(1) odpowiedzi
2017-04-10 16:04 Sinatra and Postgresql -- how to use pure Sql, perhaps without ActiveRecord »
I have a quite simple Sinatra application for which I don't want to bother to create a model. I need to insert data into a Postgresql database without...
(1) odpowiedzi
2017-04-10 16:04 How to include erb file on another? »
I have template file .erb with HTML code inside. How to include it in another file erb? I tried to use section but this is not that I need ...
(1) odpowiedzi
2017-04-10 12:04 Block redirect to other posts pages »
I have 2 tables: posts and users(their relation is many-to-many), User has many favorite_posts(with FavoritePost table(it consists of user_id and post...
(1) odpowiedzi
2017-04-10 08:04 For loop in job schedueler Resque running in set interval »
I have a database that contains some tweets/text that I want posted to twitter in a set interval (for example: every 60 seconds). The tweets should it...
(1) odpowiedzi
2017-04-09 22:04 Ruby: class passes methods of running object »
I have a class where I create a new instance variable called @client which is an object in itself. Now, in another file I create an object from this c...
(1) odpowiedzi
2017-04-09 21:04 Rails - NoMethodError in Controller »
My application has a Patient which has many requests and additionals associated with it, every time I try view my additionals for a patient I get the ...
(2) odpowiedzi
2017-04-09 18:04 PG::SyntaxError: ERROR: syntax error at or near "USING" »
I'm having trouble migrating my table with Rails. When I run rake db:migrate I get this error. Error PG::SyntaxError: ERROR: syntax error at or nea...
(1) odpowiedzi
2017-04-09 05:04 Ransack undefined method `empty?' »
i'm trying to get a collection of feedbacks from the shop but using ransack and search and comment_cont from feedbacks and the logs show: ActionView...
(1) odpowiedzi
2017-04-09 03:04 How to deal with English contractions programmatically [Regex, JS, Ruby] »
I am capturing natural language user input and I need to check it against a predefined "correct" version. This much is trivial, but I am unsure about ...
(1) odpowiedzi
2017-04-09 03:04 Error: No template found for XxxController#update, rendering head :no_content »
Hello i have the follow code working in development. class SetupController < ApplicationController def update if current_user.update_attribu...
(2) odpowiedzi
2017-04-09 02:04 Why do database checks not raise errors in rspec, but do raise errors in rails console? »
I'm writing a blog app using rails 5.0.2, ruby 2.4.0, and postgresql 9.6.2. I wrote some tests using Rspec to check that the postgres check constraint...
(0) odpowiedzi
2017-04-09 01:04 What is file-based source code? »
In the book "Programming Ruby" it says that ruby has file-based source code. Take a true object-oriented language, such as Smalltalk. Drop the u...
(1) odpowiedzi
2017-04-08 22:04 Ruby on Rails cannot load such file -- maxminddb »
I'm trying to use the MaxMindDB gem to use thew new MaxMind v2 geoip database. I've added the gem to my gemfile and installed it. But when I try to r...
(1) odpowiedzi
2017-04-08 19:04 How to return json using mongoid »
I have a model: class Client include Mongoid::Document field :name, type: String field :age, type: Integer index({ name: 1 }, { unique: true ...
(1) odpowiedzi
2017-04-08 11:04 Why is an Array in my payload being flattened in Sinatra / Rack::Test? »
I'm trying to test a small Sinatra app using rspec. I want to pass a rather complex payload and am running into issues i do not understand: my payload...
(1) odpowiedzi
2017-04-08 06:04 no implicit conversion of Symbol into Integer Error with hash »
I get the error "no implicit conversion of Symbol into Integer" Here is my code: # == Schema Information # # Table name: my_payments # # id ...
(1) odpowiedzi
2017-04-08 05:04 what does the following line do in the following ruby code? »
what does this line mean? $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__) ...
(1) odpowiedzi
2017-04-08 03:04 ruby equivalent perl command for replace newlines from file? »
Im trying to get a equivalent ruby command of this perl command this is my file centroid 100x50+0+0 28x22+39+9 19x22+68+12 15x23+5+13 15x24+22+10 ...
(2) odpowiedzi
2017-04-07 21:04 How to reuse a random letter »
I'm trying to get my code to randomly generate a letter to begin each word of "zip", "zap" and "zop". A different letter should be chosen every time t...
(2) odpowiedzi
2017-04-07 19:04 Sort Nested Data Structure »
Given a nested hash (see below) I would like to sort siblings which have a ':position' attribute. In the hash below you can see the child and child_...
(2) odpowiedzi
2017-04-07 16:04 undefined method `total_pages' for #<Tuto::ActiveRecord_Relation:0x007fc3b2473d80> »
I found couple of similar cases but nothing to fix my problem... I am using the gem Kaminari to paginate my app. Since I added it, researches are fa...
(1) odpowiedzi
2017-04-07 15:04 can't run rspec test Ruby on Rails »
I'm trying to run a test from root directory but I just get errors. Terminal screenshot Instead if I run the test form the spec folder I don't get a...
(0) odpowiedzi
2017-04-07 13:04 upgrade ruby on rails on mac sierra error »
I'm having problems to update my ruby and install rails, everything seems to be installed brew install rbenv ruby-build Warning: rbenv-1.1.0 already...
(1) odpowiedzi
2017-04-07 13:04 Duplicating SQL Row in Ruby »
A basic function that I just can't get my head around. I need to copy the values from one MySQL row to a new row - sounds easy. I've tried the below...
(2) odpowiedzi
2017-04-07 12:04 RSpec testing controllers from models depending on foreign keys »
I'm trying to implement a testing environnement with rspec. When testing controllers, the example resource built do not persist and the 3 create tests...
(0) odpowiedzi
2017-04-07 10:04 Ruby - How is MatchData object created without .new? »
I'm creating a class (say, Bar) for an object to be returned by a method of another class (say, Foo#bar), pretty much MatchData object is returned by ...
(2) odpowiedzi