Routen
put '/happy/node/:node_id', to: 'nodes#happy', as: :happy
Knotensteuerung
def happy
@node = Node.find(params[:node_id])
if @node.update_attributes(:node_status => "happy",
:location_id => params[:location_id],
:hostname => params[:hostname])
redirect_to node_url
end
end
view - Form
<%= form_for(@node, url: happy_path(@node), method: :patch, do |f| %>
<%= f.label :location_id, "Location" %>
<%= collection_select :location_id, Location.order(:name), :id, :name, :prompt => "Select Location" %>
<%= f.submit "Save Changes" %>
Ich versuche, den Knoten zu aktualisieren form mit einer benutzerdefinierten Aktion.Wenn ich dies versuchte es scheiterte kläglich.Ich werde sehr dankbar für Ihre Hilfe sein.Keine Route treffer [patch] „/ happy/node/10003
Ich habe auch versucht, beides einzubinden, aber das Formular wird nicht übergeben. – nordic
Was ist auf Ihren Protokollen beim Absenden nicht passiert? Und ich habe mich gefragt, warum du diesen Teil 'url: happy_path (@node) 'brauchst. – araratan
Keine Vorlage gefunden für NodesController # happy, rendering head: no_content – nordic