On Lunes, 18 de Octubre de 2010 12:58:13 Iñaki Baz Castillo escribió: > 2010/10/18 Sergio Cambra .:: entreCables S.L. ::. <[email protected]>: > > I'm not sure how to work around this case, when a field is empty no > > condition is generated for that field, because is not required filter by > > all fields. Maybe checking for condition_for_#{column.name}_column could > > be moved above checking blank value. Are you using master branch? > > I'm using master branch. I'm not sure of hot to use condition_for. I > assume I must add the following method in clis_controller.rb: > > def condition_for_Status_Flag_column > "SELECT `clis`.* FROM `pv_clis` WHERE (((`clis`.`Status_Flag` = > '#{TODO_WHAT_HERE}'))))" > end
No, it must be a class method, so use def self.condition_for.... Also, it only should return condition part for ActiveRecord find method: def self.condition_for_Status_Flag_column(column, value, like_pattern) ['clis.Status_Flag=?', value] end You will have to update your master branch because I have added support for custom condition methods even with blank values today. > > Am I right? anyhow: > - What to replace in TODO_WHAT_HERE? > - Do I need to add the LIMIT and ORDER BY in the query? > > PS: I couldn't find documentation for "condition_for" in the wiki ¿? > > Thanks a lot. It's documented in Search Overrides, inside API: http://github.com/activescaffold/active_scaffold/wiki/Search-Overrides -- Sergio Cambra .:: entreCables S.L. ::. Mariana Pineda 23, 50.018 Zaragoza T) 902 021 404 F) 976 52 98 07 E) [email protected] -- You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/activescaffold?hl=en.
