Reputation: 677
I'm trying to have something like this work:
- @ordered_articles.each do |x|
%tr
%td= x.short_title
%td= x.label.nil? ? '' : x.label.title
%td= published_at(x)
%td= last_update(x)
%td= x.radio_button :checked =>"false"
but I get the error: undefined method radio_button
Any idea how I could possibly get this to work?
Upvotes: 1
Views: 889
Reputation: 386
Putting form inputs inside table element will usually lead to errors.
My advice would be to either use div
s instead of a table, or put individual forms inside of each of the td
elements.
for example:
%td
= form_for @something, html: {id: "radio-form" } do |f|
= f.radio_button :checked =>"false"
= f.submit style: 'display: none;'
then add some javascript to submit on change:
$(document).ready(function(){
$("#radio-form input[type=radio]").change(function() {
$(#radio-form").trigger("submit.rails");
});
});
Upvotes: 1