CRUD on attribute in N/N join table
3
Rails
Hi!
I am struggling with a many to many relation to access an attribute stored in the join table.
I basically have two models :
- "User" which has_or_belongs_to_many :items
- "Item" which has_or...
Chris Oliver replied
Solved
Best Practices for storing API Keys, DB user / passwords, etc...
1
Rails
I would like to get everyone's take on what are is the best practice for storing DB usernames/passwords, API keys, Contstants, Etc... Should they be stored in config/environments/ then in test, dev...
Chris Oliver replied
Solved
Active storage has_many_attach replaces older images instead of appending them in Rails 6
1
Rails
Was having issues with this but found out behavior was changed from Rails 5. You have to now add the following in your `application.rb` file:
```
config.active_storage.replace_on_assign_to_many...
Marcus S replied
Solved
How do I override the default link_to helper?
3
Rails
I accept a lot of user input links and output them as anchor tags. As a result, I'm worried that there may be cases of users trying to inject Javascript into the href attribute.
I would like to ov...
Chris Oliver replied
Solved
Mailboxer Issue
1
Rails
I setup the Mailboxer gem in my application. Everything was working fine, except a read conversation kept showing up as unread. I decided to run this command in the rails console: [user].mailbox.co...
MicahBHoward replied
Solved
Nested preference settings with activerecord store
2
Rails
As per this [Episode 191][1] is there any way I can add nested settings? for example:
```
{
"wants_reminders": true,
"wants_deals_offers": true,
"subscribed_to_newsletter": true,
"something_here":...
Chris Oliver replied
Solved
Dynamic nested forms with Stimulus *and* has_many :through relationship
4
General
Hi team,
I've been following along with the [Dynamic Nested Forms with Stimulus JS](https://gorails.com/episodes/dynamic-nested-forms-with-stimulus-js?autoplay=1) lesson, but I've been attempting ...
David McDonald replied
Solved
PG::InsufficientPrivilege: ERROR: permission denied to create extension "pgcrypto" HINT: Must be superuser to create this extension. : CREATE EXTENSION IF NOT EXISTS "pgcrypto"
1
Databases
Hi everyone, I have been deploying following the guides of this site. However, I had introduced the use of UUID and so I have set the use of extensions for PostgreSQL. Now, when I deploy, I get the...
Julio Cesar Fausto replied
Solved
splitting asset pipeline for front and backend
1
Rails
app has a consumer facing part and large backend/CMS part.
our assets (JS and SCSS) are precompiled into a very large file
in layouts we have a different layout for front- and backend
Is it possib...
Yi Mei Wang replied
Solved
When installing Rails 6 on Ubuntu 20.04 I get an error with the Nokogiri gem
1
Rails
I have been following the instructions at https://gorails.com/setup/ubuntu/20.04#ruby-rbenv. I get the following error,
Installing nokogiri 1.10.9 with native extensions
Gem::Ext::BuildError: ERRO...
William Jones replied
Solved
Iterating using css grid
13
CSS
Hi Chris - I am using CSS grid for a three-column blog layout. Unfortunately, when I run the do bock it creates three instances of the same post. I guess this is to be expected.
Not sure how to ge...
Brian Gilbank replied
Solved
Anyone with experience using Quilljs?
6
Javascript
Hi,
I'm lloking forward using http://quilljs.com in a project and wonder if anyone can share his/her experience with such text editor.
Related gems are looking pretty outdated (I'm using Rails 5)...
Stas Syritsyn replied
Solved
guard-minitest runs ALL tests not just the ones for the target file changed
1
Testing
I stripped my Guardfile down to this. If I edit a controller guard starts ALL tests.
`guard :minitest, all_on_start: false, all_after_pass: false, spring: true do
watch(%r{^app/controllers/(.+)_...
Solved
embed youtube in actiontext?
2
General
Chris, I see you already referred to the problem of embedding Youtube videos in actiontext
https://github.com/excid3/cfps/blob/3bed21b7aa319ce8e0a98283965ab64df2597488/2020-railsconf.md
Did you m...
ya na yandex replied
Solved
rails test attempts to create multiple test databases and fails because it cannot connect
1
Testing
rails 6.0
minitest 5.1
mysql2 gem
I'm having (what seems to me) a rather peculiar problem running **rails test** right from the get-go. All the correct databases exist, the rails user has what sh...
Ian Burry replied
Solved
Using custom scaffold templates for Rails models and controllers?
1
Rails
After getting tired of rebuilding all my default scaffold models, views and controllers I decided to create custom templates as outlines on various blogs / SA questions etc.
I created:
/lib/t...
Dan Tappin replied
Solved
Rails - adding nested attributes then validation fails, new nested attributes are not passed back to the :edit render
1
Rails
I have a Rails app with nested attributes. My MVC works great except when the nested validation fails. Here is my parent model controller:
def update
if @model.update(model_params)
re...
Dan Tappin replied
Solved
Issue deploying Rails app with capistrano
1
Rails
Hello all. This is my first time ever trying to deploy a Rails application. I followed the guide to do so on Ubuntu 20.04, but I run the command `bundle exec cap production deploy` and it gets to t...
William Kennedy replied
Solved
How do you make a tab stay "active" after a page reload
6
Javascript
I have a version of your [Tabs tailwindcss-stimulus component](https://github.com/excid3/tailwindcss-stimulus-components/blob/master/src/tabs.js) up and running. However, I'm struggling to figure o...
Christian Whitesides replied
Solved
How can I render \\n as newlines in <pre><code> elements?
2
Ruby
I need to render the post's body as HTML, but as it is given to me, it has some "\\n", "\\r" and "\\t" characters. How can I replace them with newlines, carriage return and tab characters respectiv...
Solved