Data dodania Pytanie
2018-02-19 17:02 Ruby on Rails: render form on a shared folder »
I want to put the form on a shared folder for DRY the code and render this form for [:admin, :posts] and :posts. So I create a folder and put the form...
(2) odpowiedzi
2018-02-19 15:02 Rails / ActiveRecord: avoid two threads updating model at the same time with locks »
Let's say I need to be sure ModelName can't be updated at the same time by two different Rails threads; this can happen, for example, when a webhooks ...
(2) odpowiedzi
2018-02-19 15:02 How to create a link_to_if with block only if condition is met? »
I want to render a link only if the condition is met with the following link_to_if: <%= link_to_if policy(@user.add?), new_entry_path(), class: 'b...
(3) odpowiedzi
2018-02-19 10:02 Rails activerecord sort_by not sorting? In some situations »
I'm so confused. I have some Notes, and I need them to be sorted by urgency. Urgency is a virtual attribute, determined like so: def urgency self....
(3) odpowiedzi
2018-02-19 10:02 Rails, using rspec to run one file »
I want to run an rspec test on one file. I have tried various methods such as rspec path/to/spec/file.rb rake spec SPEC=spec/controllers/sessions_c...
(1) odpowiedzi
2018-02-19 06:02 How to create reports in Excel or Word using Rails? »
Suppose there is a table with data and by certain criteria (for example by date) you need to generate a report as txt or xml. So here is how it can be...
(1) odpowiedzi
2018-02-19 01:02 Rails route masking »
I have a rails app where I have a userpage. Each userpage is a dashboard for a user showing his listings and his activities. I am also using a User mo...
(1) odpowiedzi
2018-02-18 22:02 rails syntax erorr: wrong number of arguments »
while building a website with rails, I found a little syntax error that I really don't understand what caused it. class User < ApplicationRecord ...
(2) odpowiedzi
2018-02-18 18:02 dynamically adding button based on my label text database column in rails »
I have a rails app, in which I want to add buttons dynamically based on my label text in the database.I have a questionnaire schema and it contains la...
(1) odpowiedzi
2018-02-18 11:02 Using changed and changed_attributes in validation before saving gives a depreciation warning »
I get a depreciation warning from Rails (5.1.5) when I'm using this customer validation to prevent unwanted changes on a model: class Post < Appli...
(2) odpowiedzi
2018-02-18 11:02 Rails 5: dynamically get the model name to create versions with Carrierwave »
I'm trying to dynamically create a version of a Carrierwave image if the polymorphic association is of a certain model, and skip it otherwise. For in...
(0) odpowiedzi
2018-02-18 10:02 Rails 5: Gem bcrypt - is throwing an error "cannot load such file -- bcrypt" »
I am a Rails beginner. When i am trying to use gem bcrypt, i see an error on my screen "cannot load such file -- bcrypt" control stuck at 'has_secure_...
(1) odpowiedzi
2018-02-18 05:02 Make a Scope condition check if an Array has at least one element of another array »
I'm trying to make a scope that brings back all the buildings that have at least one of the uses that I send in an array as a parameter. My Building ...
(1) odpowiedzi
2018-02-17 23:02 How do you manage Postgresql database connections in Rails? »
I am using Upsert in a Rails app and as a result there are a number of Postgresql connections that I am creating on my own: connection = PG.connect(d...
(1) odpowiedzi
2018-02-17 23:02 Ruby When use and pass parameters to functions? »
I would like to redirect the user in the authetication method if the request format is html or json, but always just show as the json format has been ...
(1) odpowiedzi
2018-02-17 21:02 RSpec view with count dependency test »
I would like to test this Rails view with RSpec. <% if @search_results.count > 0 %> <%= render partial: 'booklist', locals: { b: @sear...
(0) odpowiedzi
2018-02-17 19:02 unexpected indentation in coffee rails? »
I am trying to make infinite scrolling in rails using will_paginate and coffee and after i have made the code it gave me this error ? I USE ATO...
(1) odpowiedzi
2018-02-17 18:02 Add custom static 404 and 500 error pages to a Rails app, and test they work? »
How do you add custom static 404 and 500 error pages to a Rails app, and then test, with rspec, for example, that they are working? ...
(1) odpowiedzi
2018-02-17 18:02 Active Admin Querying on Association Tables Column presence and on its value »
I want to active admin filters on an admin panel page based on its column presence. The model association is as follows: class User < ActiveRecor...
(0) odpowiedzi
2018-02-17 17:02 FactoryBot.lint undefined method `match' for nil:NilClass (NoMethodError) »
I defined these factories with associations: *spec/factories/topics.rb FactoryBot.define do factory :topic do name { Faker::Company.name } en...
(0) odpowiedzi
2018-02-17 02:02 Downloading an image from S3 using carrierwave (without open) »
I'm using Carrierwave to upload my images to S3 which works fine. I would like the user to click a 'Download' link which will auto download the image ...
(2) odpowiedzi
2018-02-16 23:02 Display a custom string of enum status in a pie chart Rails »
I'm using Chartkick Gem to display a pie chart about medications' statuses. The status its a enum field like the following enum status: { good: 0, ne...
(1) odpowiedzi
2018-02-16 23:02 ruby on rails tutorial chapter 8 test error »
I'm getting two different test errors in Chapter 8.2.1 of Michael Hartl's Ruby on Rails Tutorial. I'm new to Rails, but I have triple checked for synt...
(1) odpowiedzi
2018-02-16 20:02 How to merge two models with one-to-many relation in Rails? »
I have two models, say Author and Book, where an Author has many Books. I have to fetch through AJAX a list of Authors' names with their respective Bo...
(3) odpowiedzi
2018-02-16 17:02 RSpec: how to test database fails when there's more database operations »
I have a method similar to this: def create reservation = Reservation.create(params[:reservation_params]) if reservation.valid? reserved_hour...
(1) odpowiedzi
2018-02-16 17:02 Rails - Order index by complex sort »
How do I order my index results by featured_end_date >= Time.now() in :asc order and then have the rest of the results sort by by publish_at: :desc...
(2) odpowiedzi
2018-02-16 16:02 Datatable javascript does'nt show icons on pages »
I'm working with the javascript datatable in rails. I have a table that has icons in a column instead of words (when you click on actions). My table...
(0) odpowiedzi
2018-02-16 14:02 Difference between spec and test folders »
I have a concept problem, I am working on a rails project & as per my knowledge both the test & spec are used for tests. Where test refers to ...
(1) odpowiedzi
2018-02-16 14:02 Refresh database (mySql) using jquery rails »
I am trying to read data from mysql database, it is basically the pincode and comparing it with the near location. I need to check the database every...
(1) odpowiedzi
2018-02-16 13:02 GKE kubernetes delayed_job pod logs »
I have a deployment object with the following rake jobs:work command: apiVersion: extensions/v1beta1 kind: Deployment metadata: name: staging-delay...
(0) odpowiedzi
2018-02-16 10:02 How to stop running activeadmin on startup »
I need to separate admin panel from the regular application, so I want to run two instances where A will be responsible for regular app and B will be ...
(1) odpowiedzi
2018-02-16 06:02 How can I prevent ActiveJob from performing if the object it should perform on is deleted? »
I have a background job that does some work on uploaded images, but sometimes the image is deleted by the user before the background job is performed,...
(2) odpowiedzi
2018-02-15 22:02 Reinserted deleted record in rails using the console »
I have a record which I deleted and now I need to reinsert it with the same id as before. I have the whole object saved. Is there a way I can directly...
(1) odpowiedzi
2018-02-15 13:02 Relation does not exist issue »
I am running into an issue when migrating the db class CreateBlogoTaggings < ActiveRecord::Migration def change taggings_table = "#{Blogo.ta...
(1) odpowiedzi
2018-02-15 11:02 Active Record not deleting data in cucumber feature »
Facing a weird problem. In the following code Log is an active record table. This method is called within a cucumber feature. This method does not th...
(1) odpowiedzi