I need to submit a hash of attributes directly from the form tag. Is this possible?
<form action="/members/1/comments" method="post">
[some element] {"coordinator\_id"=>"1", "time"=>"1230", "info_link"=>"cnn.com"}
<submit>Post</submit>
</form>
This hash should arrive as 'comment' => {"coordinator_id"=>开发者_StackOverflow中文版"1", "time"=>"1230", "info_link"=>"cnn.com"}
Almost possible, but not recommended, you should give your values proper names instead, but here is what you asked for:
<form action="/members/1/comments" method="post">
<input name="comment[coordinator_id]" type="hidden" value="1" />
<input name="comment[time]" type="hidden" value="1230" />
<input name="comment[info_link]" type="hidden" value="cnn.com" />
<submit>Post</submit>
</form>
精彩评论