El Thursday 08 January 2009 08:50:57 Sujee Maniyam escribió:
> Hi all
> I am trying to do a custom field search based on parent:
>
> db table : businesses
> {
> id
> parent_id
> name
> }
>
>
> class Business < ActiveRecord::Base
> acts_as_tree, :order => :name
> end
>
> In my controller:
> active_scaffold :business do |config|
> config.actions.exclude :search
> config.actions << :field_search
> config.columns[:id].search_sql = "businesses.id"
> config.columns[:parent_id].search_sql = "businesses.parent_id"
> config.field_search.columns = [:id, :parent_id, :name]
> end
>
>
> The search section shows up with parent_id (treated as integer, as I
> see equal, less-than ..etc) comparators. How ever when I do a search
> for parent_id = 10, I get
>
> undefined method `downcase' for {"from"=>"10", "to"=>"",
> "opt"=>"="}:HashWithIndifferentAccess
>
> The error happens even if I skip the 'search.sql' definition for
> 'parent_id'
>
> ENV:
> rails 2.2.2
> AS latest GIT version
>
> what am I missing?
Please, post trace from log.
Anyway, you can search in parent column instead of parent_id so you will get a
select field. I think it's not usual to search id.
You can change:
config.actions.exclude :search
config.actions << :field_search
with
config.actions.swap :search, :field_search
Althought I think isn't different, only shorter.
--
Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.
Nicolás Guillén 6, locales 2 y 3. 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
-~----------~----~----~----~------~----~------~--~---