avo-hq / avo

Build Ruby on Rails apps 10x faster
https://avohq.io
Other
1.5k stars 238 forks source link

create_association in resource policy does not work with belongs_to associations, only on has_many #3266

Open NowakJR opened 1 week ago

NowakJR commented 1 week ago

Context

def create_association?
   false
end

does not hide "create new association" button if relation is belongs_to, seems to work fine with has_many The workaround is adding can_create: false to belongs_to field, then the button wont be visible, but it would be nice to have it all in one place

System configuration

Avo version: 3.7.4

Rails version: 7.0.8.4

Ruby version: 3.2.2

License type

Are you using Avo monkey patches, overriding views or view components?

Paul-Bob commented 1 day ago

From https://discord.com/channels/740892036978442260/1282674626039779430/1288442644728516668