将参数传递给上传者/从上传者内部访问模型的属性/让用户选择缩略图大小
我想将图像裁剪为用户从列表中选择的尺寸(例如 100x100px、200x200px...) 我如何将该属性传递给上传者或从上传者中获取模型的属性?
从上传器内部访问模型的属性如下不起作用:
version :thumb do
thumbnail_size = model.thumbnail_size
...
...
end
我收到以下错误:
# 的未定义局部变量或方法“model”
谢谢! 弗洛里安
I would like to crop an image to the size the user has selected from a list (e.g. 100x100px, 200x200px,...)
How would I pass that attribute to the uploader or get the model's attribute from within the uploader?
Accessing the model's attribute from within the uploader as following does not work:
version :thumb do
thumbnail_size = model.thumbnail_size
...
...
end
I get following error:
undefined local variable or method `model' for #
Thank you!
Florian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了能够访问模型的属性,我必须添加一个操作助手。
In order to be able to access the model's attribute I had to add a manipulation helper.