group by 语句的使用 resources do member的使用
group by 语句
select city ,count(*) as num from staff group by city;

resources :photos do
member do
get 'preview'
end
end
定义preview
def preview
end
但是不能根据id查看,所以直接使用show即可
用于查找id
在controller文件可以增加
def show
end
这样也是可以的。那么上边的内容就可以直接换掉
def show
16 render json: {
17 image: "ipfs://QmQMJX4azuY2yREjprkwEUvX9caSAbPHE8MnwzpzLJungk",
18 external_url: "https://www.lueluelue.link/",
19 desscription: "Congratulations on being the first users of LUELUELUE. you are a true Web3 supporter and builder with unwavering pioneering spirit and extraordina
20 animation_url: "ipfs://QmRuTwaZdZ65aEAz5NPwz8N6QskQsTQwkX4X98ior9GaNN",
21 name: "LUELUELUE Pioneer Medal #{params[:id]}",
22 arrtributes: '[]',
23 }
24 endresources :nft_assets, only: [:show] do
102 collection do
103 post :update_nft_assets
104 end
105 end#{params[:id]}
Rails Routing from the Outside In — Ruby on Rails Guides