一个问题Active Storage(刚刚更新到rails 5.2)试图打开附加文件,保存在blob上,重定向到root_path任何想法我怎样才能打开/下载它.
我在rails视图中的代码是:
<%= link_to(document.filename, rails_blob_path(document, disposition: "attachment")) %>
Run Code Online (Sandbox Code Playgroud)
TIA
我注意到当我想获取对象集合 (@user.all) 时,我必须使用 each_serializer
render json: @users, root: 'data', each_serializer: User::ShowSerializer
Run Code Online (Sandbox Code Playgroud)
而当我必须有一个对象时,显示动作序列化程序可以工作。
render json: @user, root: 'data', serializer: User::ShowSerializer
Run Code Online (Sandbox Code Playgroud)
请任何人都可以解释两者之间的区别
我无法找到这个 rubocop 警告的问题
Do not chain ordinary method call after safe navigation operator.
price_array = user&.user_price_fluctuation&.market_price&.sort << user_price&.sort
Run Code Online (Sandbox Code Playgroud) 我想查询总金额(这是所有记录中的一列),并可以选择日期来获取这些日期之间的金额总和。
最好的方法是什么?