I would like to customize the field search, but AS ignores
field_searches specified unless they are the name of a column in the
database.

For example, the code below renders lots of search options for Users.

class UsersController < ApplicationController
        skip_before_filter :owner_required

        active_scaffold do |config|
                config.actions = [:field_search, :show, :create, :list, :nested]
        end
end

But I want to add a custom search where I can specify the sql (could
be using the rails find api) with one or more input params.  First
thing I tried was adding a "virtual" search attribute "my_column"

                config.columns.add :my_column
                config.field_search.columns = :my_column

AS now renders nothing.  Okay.. maybe it does not know how to build
the search, but a default text box would be okay for now.  Tried added
a help method


        def user_my_column_search_column(record, input_name)
                select :record, :item_type, options_for_select(Item.item_types),
{:include_blank => as_('- select -')}, input_name
        end

Any suggestion on how to get AS to render a search form that includes
"my column".

Then, in the controller, would like to define

        def self.condition_for_my_column_column(column, value, like_pattern)
                value.length > 0 ? ["status IN (#{value.collect{|t|
"'#{t}'"}.join(",")})"] : nil
        end

Actually, would like to be able to have a much more complex search,
with a join across several tables, but let's start with something
simple.

Thanks.

-- 
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.

Reply via email to