EmanuelRodriguezBedeman

Joined

20 Experience
0 Lessons Completed
0 Questions Solved

Activity

I'm on the same problem, guess I'll just rollback right before this lesson.

Fixed, I needed to use turbo for this. I'll leave the code below:

<%= form_with model: tweet, data: { turbo: true }, local: true do |form| %>
<%= render "shared/form_errors", form: form %>

<div class="mb-3">
    <%= form.label :twitter_account_id  %>
    <%= form.collection_select :twitter_account_id, Current.user.twitter_accounts, :id, :username, {}, { class: "form-control"} %>
</div>

<div class="mb-3">
    <%= form.label :body %>
    <%= form.text_area :body, class: "form-control" %>
</div>

<div class="mb-3">
    <%= form.label :publish_at %>
    <div class="form-control">
    <%= form.datetime_select :publish_at %>
    </div>
</div>

<%= form.button "Schedule", class: "btn btn-primary" %>

<% if form.object.persisted? %>
    <%= link_to "Delete", form.object, data: {turbo_method: :delete, turbo_confirm: 'Are you sure?'}, class: "btn btn-outline-danger" %>
<% end %>

<% end %>