ActiveScaffold is nice to get fastest results in short time but is a pain-on-ass if you try to made more.
In my case, I needed to show in a list some type of documents filtered by the conditions_for_collection method.
def conditions_for_collection ['type_document_id in (?)', [12]] #you mean hardcode. I use a number but you can use a variable. end
It's works fine, but If you would like to have access to a nested scaffold and be able to see all related document without filtering them, the things go wrong.
I've solved this issue asking if we are in a nested scaffold.
def conditions_for_collection unless !params[:nested].nil? ['type_document_id in (?)', [12]] end end
It Works now! I hope you enjoy.
Comentarios recientes
44 weeks 2 days ago
46 weeks 3 hours ago
1 año 26 weeks ago
1 año 28 weeks ago
1 año 41 weeks ago
1 año 45 weeks ago
1 año 51 weeks ago
1 año 51 weeks ago
1 año 51 weeks ago
2 years 1 día ago