ruby-on-rails-5 Questions

9

Brand new Rails application. Rails version 5.0.0.1, Ruby version 2.4.0preview2. Create application "demo", run a simple scaffold generate Product, and get an error when trying to view the scaffol...
Shantae asked 28/9, 2016 at 7:59

2

Solved

I have this code that I want to reuse in several specs: RSpec.shared_context "a UserWorker" do |user| let(:mock_context_user) {{ id: 1, brand: user.brand, backend_token: user.backend_token }...

3

Solved

Made a new API in rails 5 using default --api tag and installed devise_token_auth gem using command rails generate devise_token_auth:install User auth . On doing rake:db:migrate, I get this error u...

0

According to Ransack documentation, there is a possibility to pass custom arguments to a ransacker method: class Person < ApplicationRecord ransacker :author_max_title_of_article_where_body_le...
Dessiatine asked 19/7, 2019 at 21:35

1

I was working with Rails 5.2.3 and got the below error: undefined method content_security_policy? for class. After looking at the error I found that it generates due to csp_meta_tag in layout...
Congruent asked 15/7, 2019 at 17:43

2

I'm trying to set up a new Rails 5 application (ruby 2.3.1, rails 5.0.0.rc1) with postgresql, devise gems and it is failing to run rails db:seed due to following error: PG::UndefinedTable: ERROR: ...
Lumpen asked 12/6, 2016 at 5:49

1

Solved

I'm having an issue with image/pdf uploads with ActiveStorage. The images appear to be uploading without issue, but they are causing errors when I try to show them. My blog model has_one_attached ...
Galatians asked 20/9, 2018 at 1:59

1

Solved

I've found several different threads on including assets in the vendor/assets directory but did not find anything that worked for me. Previously, I had all of my vendor assets in the app/ directory...
Koetke asked 4/7, 2019 at 19:43

4

Solved

I need to check an Array and see if it contains only certain values of another Array. I can think of ways to do this using the methods map and select and then iterating through the array wit...
Studdard asked 3/7, 2019 at 9:29

2

Solved

I'm attempting to deploy a Rails app to Heroku. It's been a while since I deployed anything there, but I'm at a loss for what's going on here. It's a fairly basic Rails 5 application. Deployment ...
Wrongdoer asked 20/6, 2019 at 6:19

1

I have a product, user and product_click model. In product_click, I have column count where I'm keeping a record, which user click which product how many times. I have also tried Product.sort_by{...
Eason asked 19/6, 2019 at 13:59

3

Solved

I have a few parts of the solution, but I'm having trouble bringing them together. I have a page with two text fields (in a form_tag) in which I'll enter a datetime string with the start and end ...
Dilettante asked 29/6, 2017 at 0:49

2

Solved

I try to change the default column value from false to true. But when I run rake db:migrate VERSION=904984092840298 I got the following ERROR. StandardError: An error has occurred, this and all la...

4

Is there a way to terminate the subscription to a particular channel for any particular consumer from the server side (controller) so that disconnected callback in my coffee script file can be invo...
Shoer asked 2/10, 2016 at 8:29

1

Solved

I accidentally created a rails app that already exists (i.e. rails new existingapp) The terminal says Overwrite /Users/username/Desktop/existingapp/.gitignore? (enter "h" for help) [Ynaqdhm] ...
Bankable asked 24/5, 2019 at 23:50

1

This seems like a common error with Postgres 10 but I am not sure if its just Postgres 10 or its because I am using Rails 5 as well. I have a Rails 5 application on Digital Ocean that is getting re...
Conlin asked 8/5, 2018 at 20:53

4

Solved

Found out that rails 5 has a native uuid integration, wanted to try it out but I'm getting this error: == 20170330041631 EnableUuidExtension: migrating ============================== -- enable_ext...
Puree asked 5/4, 2017 at 4:55

1

I have a Rails 5 app using webpacker that displays a list of users. The logic to do so is in a partial that has Vue component code in it, like <profile_modal> <template slot="trigger"&g...
Featheredge asked 7/5, 2019 at 17:12

3

I am working on a Rails 5.2 app and I have installed and setup active_storage, however, I can't seem to edit or show the rails credentials. Here is an output of the error ben@ben-VirtualBox:~/Des...
Whitmire asked 20/5, 2018 at 13:12

2

Solved

Working on a Rails 5 app, I want to use structure.sql instead of schema.rb (we're using PostGIS with lots of custom SQL calls...). In config/initializers/database_options.rb I have the following: ...
Rhotacism asked 28/12, 2016 at 20:10

1

Solved

Background Inside of my application, a series is composed of many books. A series' Show page allows a user to see all the books in a series and to add a new book to the series using a form. Every...
Erdah asked 9/4, 2019 at 15:20

2

Solved

I have a table-less model like this: class SomeModel include ActiveModel::Model attribute :foo, :integer, default: 100 end I’m trying to use an attribute from the link below, it works perfectly ...

4

Solved

I am getting an error while creating a model in the created project and the error is as follows, /home/sushmitha/.rvm/gems/ruby-2.5.1/gems/bundler-2.0.1/lib/bundler/rubygems_integration.rb:408:i...
Cheju asked 5/2, 2019 at 7:45

1

Solved

I'm trying to configure ActiveStorage to use S3 bucket as a storage backend however I don't want to pass any of access_key_id, secret_access_key, region. Instead, I'd like to use previously defined...

2

I've an ActiveRecord model. I'd like to set an initial state depending on its attributes at the initialization. Here is my condition: self.expected_delivery_date.blank? ? :in_preparation : :waitin...
Deery asked 28/10, 2017 at 9:52

© 2022 - 2024 — McMap. All rights reserved.