8,330 Experience
0 Lessons Completed
10 Questions Solved


I've been running into issue when using hyphens in the controller or target name and not 100% sure about the issue or fix—could try camelCase or try to you a controller name without hyphens.
You called your action `toggle`, but it's not actually one of the short-hand actions in [Stimulus]( 

You can try this, which should work I think:

toggle() {
It will look for the hidden class, if found, "remove" it and otherwise "add" it.
I currently interact with Stripe using small, one-off Service objects. Can be run using any background worker. 
I also set an `idempotency_key`, with simply `SecureRandom.uuid`
Since most of it is done using Javascript, you could technically copy the code from any example you have. 
As for the Rails part, you likely need to get `get` the Json for the user. Also CORS is something to keep in mind. 
I've build a couple of JS snippets/embeds. Happy to help with any specific issues.
Did you try duplicating all the keys below `en:` for your Spanish translation? I'd expect you can use the same file.

I see you can you pass in the format as a :symbol (`
<%= local_time(date, :long) %>
`), this should look for it in the `config/locale/xx.yml` files.
Doesn't it use the i18n yml in `config/locale/<xx>.yml`? 
Great base/starting point is

Posted in ibm Iseries AS/400 DB2

What is "without success"? What did you try? Which errors do you see? And more info? OS? Rails/ruby version?

Posted in User create Dynamic Role base

I recently did this using Rolify. _Fairly_ straightforward. 
FormObjects would be the way to go not save to your DB. Chris did a screencast for just this use case:

As for the image url: depends. Too little info to give a complete answer, but likely it's not a public url. See into the gem you use for file uploading for a "make public url" option.
What is in the `@ad` variable you refer to in your show action?
Are you running SSL on your development machine? Ot are you running your server in development? Bit confused by this.

Possible cause is you're redirecting to `https://…` for development. You can, for testing purposes, set your app's redirect url to `http://`—if you did not set up SSL (unlikely). Or it's the other way around—your redirect url is not properly set up (including `https://`).

There are plenty of other possible—but not enough info (for me at this point), to help more.

Posted in rendering issue

What did you set `@status_update` to in your controller's action?

Posted in Ruby on Rails migrations into a single migration?

Afaik, there's no automated way of doing this. And when I do—that is before I push to a shared repo—, I do it manually. 

Also, what's up with the link? Is this a new kind of smart spam bot? 
It's not possible to add html element (like a `<i />`) inside of an `<input />` field. You could add/move it before the input field, so it looks visually more to what you are aiming for.
Not sure why wouldn't be able to loop over the images when on the index action. You should be able to loop over your PropertyPhotos there too (eg. `<%= @property.property_photos.each … %>`). 
If you give us some code you currently have, it's easier to give some more specific solution/options.
I am afraid something else is broken than, I see a pretty blank page on both Safari and Chrome.
Looks like you fixed the issue?

Posted in What is the best way to house view logic?

Helper method with a case/switch statement would work well here.

somethng along the lines of

case step
when "step1"
when "step2"
when "step3"

You are scoping comments to the User, but not to the blog. So you need to add the blog_id too in the create action.
You can see in your log that the blog_id is empty too.

Posted in Personal records

You need to scope it to currently logged in user. if you use Devise you can use something like current_user.personal_record. This can be done in the controller's "set" before_action, or in the preferred action, eg index, show, etc

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

© 2023 GoRails, LLC. All rights reserved.