ruby-on-rails-5 Questions

1

Solved

What is the difference between these two syntax: ENV.fetch("MY_VAR") ENV['MY_VAR'] I've seen Rails 5 use both versions of these in difference places and can't figure out what the difference is (...
Citreous asked 27/12, 2017 at 2:32

2

Solved

I'm trying to use Active Storage in Rails 5.2. I found that I should create field with type file in migration, but I have an error: $ rdm Running via Spring preloader in process 40193 == 201712171...

1

Having the following mailer previewer code: class RegistrationMailerPreview < ActionMailer::Preview # Preview this email at http://localhost:3000/rails/mailers/registration_mailer/welcome de...
Mamiemamma asked 15/9, 2016 at 15:36

2

Solved

I'm running Rails 5.1.4, and I have a model that looks like this: class Quota < ActiveRecord::Base belongs_to :domain, optional: true belongs_to :project, optional: true end A quota should ...
Sororicide asked 11/12, 2017 at 23:35

0

Simple necessity, but clearly no easy way to do it with Simple Form. I need to put a span before each radio input in a Rails form that uses Simple form. I've successfully added a span to a text in...
Stalder asked 11/12, 2017 at 18:6

3

Solved

I'm using Rails 5 with Rspec 3. How do I mock a class in my Rspec method? I have the following class require 'rails_helper' describe CryptoCurrencyService do describe ".sell" do it "basic_sel...
Nureyev asked 1/12, 2017 at 21:47

0

I am using PostgreSQL 9.5.10 on the Ubuntu machine. I need to write a SQL query to select data from JSONB column. But JSONB column contains the data in YAML format as string not in JSON format. Da...
Peskoff asked 5/12, 2017 at 13:19

1

Solved

I'm using Rails 5 and trying to test a service using rspec. I created my "spec" directory per the instructions and placed my test file in there, which is require 'app/services/crypto_currency_serv...
Parada asked 14/11, 2017 at 22:43

1

Solved

My homepage displays a list of posts and when I click a post, it open as a new page, but I need to stay at the homepage and open post Show page as modal. Any idea how? Thank you
Glazer asked 18/11, 2017 at 0:42

1

Solved

I'm writing an application that will primarily be accessed via API, but will also have views for editing via web app. I would like to create a User model with authentication and authorization acro...

1

I am a newbie to Ruby on Rails.why is the update action of a RESTful route in Rails is mapped to two HTTP verbs i.e, PATCH and PUT? PATCH /articles/:id(.:format) articles#update PUT /articles/:i...
Ascus asked 17/11, 2017 at 9:29

3

I'm starting with Rails 5 and Action Cable and I would like to display a list of names of all connected registered users (something like facebook's green circle). I managed to get the name of the ...
Chit asked 16/4, 2016 at 10:27

2

I have seen ActionCable.server.open_connections_statistics, ActionCable.server.connections.length, ActionCable.server.connections.map(&:statistics), ActionCable.server.connections.select(&:...

1

Solved

When generating a new migration using bin/rails g migration CreateUser the first line will look like this: class CreateUser < ActiveRecord::Migration[5.1] What does the [5.1] stand for ...
Kreisler asked 5/11, 2017 at 20:49

1

Solved

I'm trying to make an ajax call to a rails (5.1.3) app. I want the targeted action in the controller to render a status code 200 and do nothing else. Here's how the action looks like. def some_de...
Orang asked 3/11, 2017 at 10:37

1

Solved

I'm running Rails 5.1.4 server (Puma v. 3.10.0 in single mode), but having an issue with a specific ActionJob that get's enqueued correctly but often never performed. I have a handful of jobs. All...

4

Solved

I know you can explicitly list fields like so, json.(model, :field_one, :field_two, :field_three) But is there anything similar to the following, json.(model, except: :field_two) which would ...
Cytology asked 11/7, 2016 at 20:20

2

Solved

RAILS 5.1 I have a RAILS application thats using PostgreSQL as database. I want to export/dump the RAILS database data from the RAILS perspective. So I'm independend from the database. Later then ...
Sihon asked 22/10, 2017 at 17:4

1

Solved

A report_template has_many report_template_columns, which each have a name and an index attribute. class ReportTemplateColumn < ApplicationRecord belongs_to :report_template validates :name,...

1

Solved

I am trying to get https to work for my rails application. When i try to do any post related activity on the application i am getting the following error. Exception `ActionController::InvalidAuthe...
Hid asked 17/10, 2017 at 15:5

3

Solved

How does one go about running code specifically after a console has loaded in Rails? All other answers and questions appear to revolve around running a hook at some point, but not necessarily after...
Cartesian asked 16/10, 2017 at 23:22

1

Solved

I've integrated the Shopify active_shipping gem into my site and I am trying to get negotiated rates from my UPS account (I can get regular rates). I can't find any documentation on the negotiated ...
Ambition asked 3/10, 2017 at 20:18

1

Solved

I have a form_with that calls a controller that responds in JSON. I would like to run javascript (handle errors, ...) during an event ajax:success or ajax:error. I followed the Rails documentation...
Idaline asked 13/6, 2017 at 11:33

2

Solved

Basically, with the test config set up exactly how it worked in Rails 4 (delivery method set as test etc), aside from deprecated options which I have replaced, mail only sends with deliver_now, not...

0

I have a template that displays a list of events <tbody> <%= render partial: 'event', collection: events, cached: true %> </tbody> The partial event: <% cache event do %&gt...
Amandaamandi asked 3/10, 2017 at 20:52

© 2022 - 2024 — McMap. All rights reserved.