Mark Nelson

Joined

1,320 Experience
12 Lessons Completed
0 Questions Solved

Activity

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 https://justalever.com/work/hello-rails

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): https://digitaldefynd.com/best-ruby-on-rails-course-certification/.

A good Rails 6 basic course if the one from Pragmatic Studio but this costs a lot more: https://pragmaticstudio.com/rails.

Good luck with your studies.

Posted in Rails Application Templates Discussion

Many thanks Chris. This tutorial is excellent.

Posted in Rails Application Templates Discussion

Hi Chris

I am getting a jQuery error on clicking the dropdown menu in the navbar:

Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '/' is not a valid selector.
    at Object.getSelectorFromElement (http://localhost:5000/assets/bootstrap.self-71784756e8d3ffaa8c7ffebc434ed774344cdf0d46c66c6af4a62d4504ef7ba3.js?body=1:150:35)
    at Function._getParentFromElement (http://localhost:5000/assets/bootstrap.self-71784756e8d3ffaa8c7ffebc434ed774344cdf0d46c66c6af4a62d4504ef7ba3.js?body=1:1906:27)
    at Dropdown._getMenuElement (http://localhost:5000/assets/bootstrap.self-71784756e8d3ffaa8c7ffebc434ed774344cdf0d46c66c6af4a62d4504ef7ba3.js?body=1:1758:31)
    at new Dropdown (http://localhost:5000/assets/bootstrap.self-71784756e8d3ffaa8c7ffebc434ed774344cdf0d46c66c6af4a62d4504ef7ba3.js?body=1:1590:25)
    at HTMLAnchorElement.<anonymous> (http://localhost:5000/assets/bootstrap.self-71784756e8d3ffaa8c7ffebc434ed774344cdf0d46c66c6af4a62d4504ef7ba3.js?body=1:1838:18)
    at Function.each (http://localhost:5000/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:371:19)
    at jQuery.fn.init.each (http://localhost:5000/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:138:17)
    at jQuery.fn.init._jQueryInterface [as dropdown] (http://localhost:5000/assets/bootstrap.self-71784756e8d3ffaa8c7ffebc434ed774344cdf0d46c66c6af4a62d4504ef7ba3.js?body=1:1832:19)
    at HTMLAnchorElement.<anonymous> (http://localhost:5000/assets/bootstrap.self-71784756e8d3ffaa8c7ffebc434ed774344cdf0d46c66c6af4a62d4504ef7ba3.js?body=1:2004:31)
    at HTMLDocument.dispatch (http://localhost:5000/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:5227:27)

Any idea what is causing this? Thanks.

Posted in Rails Application Templates Discussion

Thanks for this. I have come across an issue with the bootstrap nav dropdown, which is not working. In the console I get this error when I click it:

Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '/' is not a valid selector.
at Object.getSelectorFromElement (http://localhost:5000/assets/bootstrap.self-71784756e8d3ffaa8c7ffebc434ed774344cdf0d46c66c6af4a62d4504ef7ba3.js?body=1:150:35)
at Function._getParentFromElement (http://localhost:5000/assets/bootstrap.self-71784756e8d3ffaa8c7ffebc434ed774344cdf0d46c66c6af4a62d4504ef7ba3.js?body=1:1906:27)
at Dropdown._getMenuElement (http://localhost:5000/assets/bootstrap.self-71784756e8d3ffaa8c7ffebc434ed774344cdf0d46c66c6af4a62d4504ef7ba3.js?body=1:1758:31)
at new Dropdown (http://localhost:5000/assets/bootstrap.self-71784756e8d3ffaa8c7ffebc434ed774344cdf0d46c66c6af4a62d4504ef7ba3.js?body=1:1590:25)
at HTMLAnchorElement. (http://localhost:5000/assets/bootstrap.self-71784756e8d3ffaa8c7ffebc434ed774344cdf0d46c66c6af4a62d4504ef7ba3.js?body=1:1838:18)
at Function.each (http://localhost:5000/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:371:19)
at jQuery.fn.init.each (http://localhost:5000/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:138:17)
at jQuery.fn.init._jQueryInterface as dropdown
at HTMLAnchorElement. (http://localhost:5000/assets/bootstrap.self-71784756e8d3ffaa8c7ffebc434ed774344cdf0d46c66c6af4a62d4504ef7ba3.js?body=1:2004:31)
at HTMLDocument.dispatch (http://localhost:5000/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:5227:27)

I notice that in the app/assets/application.js

//= require rails-ujs
//= require jquery
//= require popper
//= require bootstrap
//= require data-confirm-modal
//= require local-time
//= require activestorage
//= require turbolinks
//= require_tree .

rails-ujs is placed before bootstrap rather than after as the template seems to suggest:

Add Bootstrap JS

insert_into_file(
"app/assets/javascripts/application.js",
"\n//= require jquery\n//= require popper\n//= require bootstrap\n//= require data-confirm-modal\n//= require local-time",
after: "//= require rails-ujs"
)

However, manually changing this in the application.js and restarting does not resolve the issue. Any ideas what the problem is?

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.

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.