Mark Nelson


5,030 Experience
49 Lessons Completed
0 Questions Solved


Posted in How do I search Action Text with Ransack?

Duplicates in the search result can be removed using the distinct option like so:

@pagy, @discussions = pagy(@q.result(distinct: true))

Use target="_top" as shown in
<%= turbo_frame_tag "tray", src: tray_path(tray), target: "_top" %>
The issue is that Turbo Frames hijacks links as described quite well here:

Posted in How to use Hotwire in Rails Discussion

What is the thinking behind moving the javascript components back to the asset pipeline?

Posted in How to use Devise Test Helpers Discussion

There is some initial unfamiliarity when switching to minitest, but in my experience this passes very quickly and minitest seems much more standard when you get used to it. Would not go back to rspec.

Posted in installed RoR, now what?

Hi Rino

One option is Andy Leverenz's

You can also look at one of the Rails courses. This site gives an overview of some of them (note that these are on Rails 4 and Rails 5):

A good Rails 6 basic course if the one from Pragmatic Studio but this costs a lot more:

Good luck with your studies.

Posted in Rails Application Templates Discussion

Many thanks Chris. This tutorial is excellent.

Posted in eval issue in Rails view

This was due to erroneous check in a containing loop which caused a blank model name to be used in the eval. The code is fine.

Posted in eval issue in Rails view

Any idea why the following code :

<% model_set = instance_variable_set("@#{table_name}", eval("#{model_name}.all")) %>

produces this runtime error:

(eval):1: syntax error, unexpected '.'

The code correctly sets the instance variable @countries to the output from executing Country.all in the console or when using byebug (model_name is "Country" and table_name is "countries").

Should this be in a helper anyway?

Thanks in advance for assistance.

Posted in Stripe Elements Javascript Discussion

I have an error where the iframe is not being displayed. Clicking the Submit Payment button shows the Your card number is incomplete error message. I also see the error reported by Andrew. Looking at Stackoverflow there seem to be a number of current issues with Stripe and Turbolinks.