eelcoj

Joined

8,330 Experience
0 Lessons Completed
10 Questions Solved

Activity

Posted in ActiveRecord/Routing madness

Looking at the error in your browser (and at your routes); your path needs an employee_id, but it looks like you're passing a Medical object instead. You probably want to create an instant variable for the Employee, so you can reference it in your create (and new) action, eg. @employee = Employee.find(params[:employee_id]). Use that instead of @medical.

As you you use default nested routes, you should be able to use simple_form_for [@employee, @medical] do |form| instead (once you've set @employee). But not 100% certain, as it might be different for simple_form (which I don't know).

Posted in Gem for Questions

This is a quite specific feature. So building something yourself is the way to go. Basically three models: User, Question, AskedQuestion (as a join model between User/Question). Check the whenever gem to easily created cronjobs.

Posted in Action mailer rails 6

Is the filename correct for that file? Maybe a typo somewhere? it's usually something as simple as that.

Posted in How to email @mentioned users (from ep #288)?

Iirc there's a screencast on GoRails on notifying users (in the video it's for forum posts).

The error says it all :)
missing required keys: [:customer_id] You need to add both your customer_id and service.id in there too, otherwise does not know which customer or service object to update. Note: that this not specfic for the best_in_place plugin, but is general Rails stuff.

Based on your routes.rb, your path should be customer_service_path() as it's nested. Check in your cli/terminal rails routes to see all the routes available to you.

I don't know best_in_place, but I reckon you can change the path to "post/put" to.

Posted in Basic CMS: Allow users to add custom CSS

Copy/paste into a text field which you can easily sanitise is probably a bit saver (for you and your users). Otherwise limiting users to change only certain aspects of the UI (colours, etc.) is often good enough. I've personally done almost full-custom layouts and the customer support for it was horrendous (“your pages are broken!”).

The easiest solution is to add a data map object to the controller element, eg. <div data-controller="modal" data-modal-preload="true"></div>. Based on your criteria you can either add "true" of false (or null)" there, eg data-modal-preload="<%= x < 0 ? true : false %>".

Then within your modal controller's connect(), check for this value to be set and true, if so fire the function that opens/shows your modal, eg. if (this.data.get("preload") && this.data.get("preload") == "true") { this.open() }.

My first guess would be you are missing the id for your Option model—so it doesn't know which Option record to update.

But stick to one as you might run into issues when (accidentally) using both. I use Yarn—for the speed.

Have you seen these: https://stripe.dev/elements-examples/ ?
I'm certain you can use the linked card “gem” with Stripe elements. Use the best of both worlds.

Posted in Rails Webpack caching

How are you loading the application.js file into your app? What command do you use to run your Rails (and webpack?) server locally?

Posted in Sortable List with GoRails Guide

Can you share what you have already? Easier to give advice based on this.

Posted in Setting Up A Third Party Theme

Are you using Sprockets/asset pipeline? Have you imported the files (css and js) into both the application.{css,js}?

Posted in How to stay strictly in Ruby ?

If less typing is what you solely after, you might be interested in Slim or Haml.

Posted in How do I use easyautocomplete in rails 6?

Looks like jQuery is indeed missing. 🙂

Posted in How do I use easyautocomplete in rails 6?

My first guess is you haven't added jquery: yarn add jquery. Are you also sure these @imports are correct?
I'm sure the console from in your dev tools would give you another clue.

Posted in How do I use easyautocomplete in rails 6?

Bit low on info to really help you here. Any errors (from console) you can share? What is your current set up?

Posted in How do I get Rails Ajax to work using ujs

Have you added the correct js “format” in your controller's action?

Posted in Connecting User with devise

I would go with https://github.com/scambra/devise_invitable
Set up a basic “has_many through” modelling and you're off to the races.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.