Data dodania Pytanie
2017-09-17 21:09 rails array with multiple fields »
I am trying to create an array that has multiple internal fields so that at the time of rendering I can save the fields of each one, something like th...
(2) odpowiedzi
2017-09-17 18:09 How to set attributes with different names than a DB schema »
I am a newbie Ruby developer. I cannot figure out how to create an ActiveRecord model with different attributes names than defined in a DB schema Con...
(1) odpowiedzi
2017-09-17 17:09 FactoryGirl ArgumentError: wrong number of arguments (given 1, expected 0) »
I'm running tests for a rails' controller and I'm finding some weird behavior. While in one of the rspec test file for another controller both methods...
(1) odpowiedzi
2017-09-17 10:09 Rspec test if edit icon is visible on index page »
I have tried doing the following but test is not able to detect that the edit icon linking to the edit page is visible to the article owner on the ind...
(1) odpowiedzi
2017-09-17 08:09 Inheriting from class Module »
I am trying to understand the shrine gem source code that is a toolkit for file attachments. You can define an uploader on your model in rails like s...
(3) odpowiedzi
2017-09-17 00:09 Someone tries to hack my Rails app in Ec2. How can I prevent? »
I went to my access.log file in my EC2 and I see these: XYZ.00.11.222 - - [16/Sep/2017:12:30:04 -0300] "HEAD /phpmyadmin/ HTTP/1.1" 302 0 "-" "Mozill...
(1) odpowiedzi
2017-09-17 00:09 Sum active record with expression rails »
I have this code in my sql view: SELECT reports.`date` reports.book_title SUM( reports.net_sold_count * reports.avg_list_price / 10 ) AS ...
(1) odpowiedzi
2017-09-16 23:09 Ruby Model Relationships - Three way Relationship »
I have an app that has 3 specific models; User, Country and City. The ideal relationship for each would be as follow: User has_many :countries has_...
(1) odpowiedzi
2017-09-16 20:09 Rails Webpacker 3.0 import CSS file is not working »
I am working Rails5 project with Webpacker in order to run React properly But when import my css file inside my root component seems it is not workin...
(0) odpowiedzi
2017-09-16 19:09 Rspec follow friends test »
I am testing a feature where a user can follow another user. Friend request will be pending until other user accepts the friend request. I can't fig...
(0) odpowiedzi
2017-09-16 16:09 form_for models with specific relations »
I have Models class Group < ApplicationRecord has_many :group_artists has_many :singers, -> { where role: "Singer" }, class_name: "GroupA...
(3) odpowiedzi
2017-09-16 13:09 How to pass foreign key manually in a join table for rails Has and belongs to many relation? »
I have two models namely Leave and Calendar. These two models have has_and_belongs_to many association. I am trying to create the join table for this ...
(1) odpowiedzi
2017-09-16 02:09 Rspec stub file valid? »
New to RoR / Rspec, created this method: def create @file = File.new(file_params) if @file.valid? #Model checks for :content_type => ['image...
(1) odpowiedzi
2017-09-15 23:09 Is it good practice to use static variables in rails controller? »
I have a question concerning best practices in rails. In my rails project I have the following code: class MyController < ApplicationController ...
(1) odpowiedzi
2017-09-15 23:09 Ruby on rails: Basic hello world return method not allowed in Heroku production »
I am really new in rails, I am currently doing the rails tutorial in Cloud9. I did a simple endpoint to test my lovely Hello World in the default Ap...
(1) odpowiedzi
2017-09-15 19:09 Rails 4: Referral Model Associations »
I am creating a referral model that will be able to link 2 clients, one that was referred and one that did the referring. I already have the client m...
(2) odpowiedzi
2017-09-15 16:09 RSpec equality matcher failing for serializer test »
I am writing a test for one of my Active Model Serializers to make sure that the JSON output is what I expect. However, I cannot figure out why RSpec ...
(3) odpowiedzi
2017-09-15 14:09 Rails: How to sort based on Average, Sum, Count with Associated Models? »
I have 2 associated tables as follows, and currently I have a reporting page which displays average, count, sum etc.. I would like to add sorting func...
(2) odpowiedzi
2017-09-15 14:09 RuntimeError: can't modify frozen Array »
I updated my Ruby on Rails app to Ruby on Rails 5.1.4. When I run my tests it returns me following error: An error occurred while loading ./spec/view...
(0) odpowiedzi
2017-09-15 14:09 Rails: choose between different root_to routes based on domain »
My idea is that if you go to www.my-website.com I want display a "choose country" landing page with links to each of my country based websites like ww...
(1) odpowiedzi
2017-09-15 13:09 Creating complex entries in multiple tables with one command? RUBY ON RAILS »
We currently try to reorganize a platform. Currently, on the productive system, each course can have multiple participants. The courses and participa...
(0) odpowiedzi
2017-09-15 12:09 rake assets:precompile stuck while deployment after adding rufus-scheduler? »
I seem to have the same problem as rake assets:precompile stuck but there's no real solution except for removing rufus-scheduler again. So, I've inst...
(0) odpowiedzi
2017-09-15 02:09 Find model based on jsonb nested data field »
I use Ruby on Rails and Postgres 9.5. In the database I have a table called events. I want to find all events based on particular value in the data ...
(1) odpowiedzi
2017-09-15 02:09 I'm trying to upload a file to DriveHQ using URI::FTP »
My code is require 'uri' uri = URI::FTP.build(['username:password', 'drivehq.com', nil, 'test.csv', 'i']) When I run this in IRB, I get => #&l...
(0) odpowiedzi
2017-09-14 23:09 Has_Many_Through & Active_Record_Collection_Proxy ERROR »
I am new to rails and am working on my first little project I have 3 models in my rails app : Restaurant <- (master model) Menu <- (relates d...
(1) odpowiedzi
2017-09-14 20:09 Routing Error Undefined method for Controller:Class »
I am trying to use a rescue_from in my controller that is supposed to be abstract. I need to catch certain custom errors there, so I am trying to eval...
(1) odpowiedzi
2017-09-14 15:09 How to do rails db:migrate on multiple shards that are not master slave relationship at once on rails? »
I have an app which which uses different database based on the subdomain. So essentially, the schema would be the same, but the data would differ for ...
(1) odpowiedzi
2017-09-14 15:09 stripe CardError (Cannot charge a customer that has no active card) »
def create_charge @amount = 500 customer = Stripe::Customer.create(email: params[:email]) pay = Stripe::Charge.create( :amount => para...
(0) odpowiedzi
2017-09-14 14:09 How to group by on other model column with relationship rails »
Each ticket has 2 timeslots. ticket.rb: has_many :timeslots, through: :visits visit.rb: has_many :tickets belongs_to :timeslot timeslot.rb: h...
(1) odpowiedzi
2017-09-14 13:09 Gracefully terminate Rails Application from within »
I have a Rails 5 application (API) and a postgres DB that run on separate docker containers, all on the same AWS EC2 instance, and are controlled by a...
(1) odpowiedzi
2017-09-14 12:09 Timing issue in active admin gem »
With in admin panel when I create a new user at 11.00 am as per my local timing is shows user created at 5:47. I found one solution config.time_zone...
(1) odpowiedzi
2017-09-14 11:09 Rails geocoder gem show results »
I'm using the geocoder gem in order to set the longitude and latitude from the address: class Item < ApplicationRecord geocoded_by :full_addre...
(1) odpowiedzi
2017-09-14 08:09 How to check validation on creation method if its called from specific route? »
I want to validate column presence on creation method if the creation method is called from some other route. For example, If I have following two rou...
(1) odpowiedzi
2017-09-13 23:09 Does a Sidekiq worker know what time it was posted? »
Assuming a Sidekiq worker wasn't posted at the same time it started (i.e. via perform_at or perform_in), is the post time stored anywhere in the worke...
(1) odpowiedzi
2017-09-13 22:09 check prawn pdf content after rendering with rspec »
I'm trying to test the content of a pdf generated by prawn, i would like to be sure that the information entered comes from the order. I get this one ...
(0) odpowiedzi