私はdrop_receiving_elementを作成したい:urlにはjavascriptが含まれている。現在、私はちょうどヘルパー関数を作成し、そのような中要素ハードコーディングされた:しかし、かなりハック醜いですjavascript in rails:urlパラメータ
def create_classification_droppable(droppable_id, classification)
"<script type='text/javascript'>
//<![CDATA[
Droppables.add('#{droppable_id}', {accept:'lead', onDrop:function(element){new Ajax.Request('/leads/' + (element.id.split('_').last()) + '.js', {asynchronous:true, evalScripts:true, method:'put', parameters:'lead[classification]=#{classification}&authenticity_token=' + encodeURIComponent('#{form_authenticity_token}')})}})
//]]>
</script>"
end
。 URLは、コールチェーンのさらに下にエスケープされているため、残念ながら、これは(なurl_forで、私は信じている)ことができていないようだ
drop_receiving_element('some_class',
:accept => 'some_other_class',
:url => formatted_whatever_path(SOMETHING_BASED_ON_WHATEVER_IS_BEING_DROPPED))
それとも
formatted_whatever_path(:id => "some_javascript", :js)
:理想的には私のような何かをしたいと思います。代替案は何ですか?