在 Rails3 应用程序中,我想为表示图像文件上传的 ActiveModel EntityImage 使用资源丰富的路径。在某个目录中,我有这些文件 dir/#{type}/#{id}/#{size}.jpg (基本上是该类的所有重要字段)
现在,可能是因为 'id' 是一个坏名字 rails wise (它不是域明智的),当我想创建一个删除按钮时,我得到一个指向:
<form class="button_to" action="/entity_images/test2" method="post">
<div>
<input type="hidden" value="delete" name="_method"/>
<input type="submit" value="Excluir" data-confirm="Certeza?"/>
<input type="hidden" value="4SWGCEfvdrWrj7xBBtlT0CR4EHPzXQaCFWF0/blmKCk=" name="authenticity_token"/>
</div>
</form>
当然,有了这些信息,我无法得到我的图像,我仍然需要知道实体的类型和大小。我怎样才能让路径助手做正确的事情?或任何其他想法,建议?