El Wednesday 18 February 2009 14:30:02 fmh escribió:
> yet the search overrides not work,
> the method has no effect and when i look my log : created_at = today
> or a value of selectbox
>
> def self.condition_for_created_at_column(column, value, like_pattern)
>     case value
>     when 'today'
>       ["created_at <= ?" , Date.today]
>     end
>   end

Sorry, I was missed.
condition methods were only for search_ui or column type, and must be defined 
in module ActiveScaffold::Finder. Your column don't have a search_ui, so it 
will try to use condition_for_datetime_column.

I have fixed it (in master and rails-2.2 branches), and now you can override 
those methods in your controller, also you can add condition methods for 
specific columns.

Now the methods are condition_for_#{search_ui}_type, such as:
condition_for_integer_type
condition_for_decimal_type
condition_for_date_type
condition_for_datetime_type

and I have added support for condition_for_#{column_name}_column methods.

>
> On 18 fév, 13:36, fmh <[email protected]> wrote:
> > it work with this
> >
> > DATE_RANGE = [["Today","today"],["Yesterday", "yesterday"],
> >    ["This Week", "this_week"]]
> >
> > def created_at_form_column(record, input_name)
> >   select_tag("#{record}[created_at]",
> >     options_for_select(DATE_RANGE, record.created_at), :name =>
> > input_name)
> >
> > end
> >
> > On 18 fév, 13:24, fmh <[email protected]> wrote:
> > > in my helper
> > >
> > > def created_at_form_column(record, input_name)
> > >     select :record, :created_at, options_for_select(['Today',
> > > 'Yesterday','This Week']),
> > >       {:include_blank => as_('- select -')}, :name => input_name
> > >   end
> > >
> > > I make like that  because  created_at_search_column return a empty
> > > selectbox
> > >
> > > Now the content of my selectbox is
> > >
> > > <option value="Today">Today</option>
> > > <option value="Yesterday">Yesterday</option>
> > > <option value="This Week">This Week</option>
> > >
> > > i check the html code :
> > >
> > > <option value="<option value="Today">Today</option>"><option
> > > value="Today">Today</option> </option>
> > > <option value="<option value="Yesterday">Yesterday</option>"><option
> > > value="Yesterday">Yesterday</option> </option>
> > > <option value="<option value="This Week">This Week</option>"><option
> > > value="This Week">This Week</option></option>
> > >
> > > it's strange
> > >
> > > On 18 fév, 12:01, "Sergio Cambra .:: entreCables - Symbol Servicios
> > >
> > > Informáticos S.L. ::." <[email protected]> wrote:
> > > > El Wednesday 18 February 2009 03:25:28 fmh escribió:
> > > > > hello,
> > > > >
> > > > > i try to use a field_search with a datetime record but it does not
> > > > > work.
> > > > >
> > > > > config.actions.swap :search, :field_search
> > > > > config.field_search.columns = :created_at
> > > > >
> > > > > how to use date range like "Today" or "this week" ?
> > > >
> > > > Default search form for date fields is searching dates in a range.
> > > > You can add a new search_ui in your helper and conditions method in
> > > > your controller
> > > > Or you can override the search form for a specific
> > > > column.http://wiki.github.com/activescaffold/active_scaffold/search-o
> > > >verrides
> > > >
> > > > --
> > > > Sergio Cambra .:: entreCables 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]
>
> 


-- 
Sergio Cambra .:: entreCables 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
-~----------~----~----~----~------~----~------~--~---

  • fi... fmh
    • ... Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.
      • ... fmh
        • ... fmh
          • ... fmh
            • ... Kenny Ortmann
            • ... Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.
              • ... fmh
                • ... Benjamín Cárdenas Salamandra
                • ... fmh
                • ... Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.
                • ... fmh

Reply via email to