On Jueves, 18 de Marzo de 2010 20:29:24 Soren Christensen escribió: > Sergio, > > How about an enhancement to this syntax ? > Lets define the syntax to be one of them - say MySQL - don't really care > which, but if the adaptor is not that particular syntax the search code > will rewrite the query to the right syntax. > I have MySQL in Dev and host on Heroku which uses PostGreSQL - so this > is a real pain.
It accepts SQL for flexibility, you can use standard SQL where is possible to avoid it, or use postgresql in development. Also you can add a field to your table instead of using CONCAT, then you can add a index to search which is faster. I don't want to add db specific code to AS, and I think ActiveRecord adapters has no method to build concat operation. > > >> ActiveRecord::Base.connection.class > > => ActiveRecord::ConnectionAdapters::PostgreSQLAdapter > > For the Concat operation: > Oracle uses '|', postgres uses '||' and MySQL & SQL server uses '+'. > > /S > > On 3/18/2010 12:02 PM, Soren Christensen wrote: > > There needs to be some documentation for the > > config.actions.swap :search, :live_search > > > > Which is required to get the live search to work > > > > Shall I just add it to the Wiki ? > > > > /S > > > > On 3/18/2010 9:51 AM, Soren Christensen wrote: > >> Hi, > >> > >> I have a lot of various associated tables - but the search seems to > >> be broken in them - did the config for search change ? > >> > >> I have: > >> > >> # Add search to the user column > >> config.columns[:user].search_sql = "CONCAT(users.first_name, ' ', > >> users.last_name)" > >> config.columns[:user].sort_by :sql => "CONCAT(users.first_name, ' > >> ', users.last_name)" > >> > >> Where user is a belongs_to column in my database. > >> > >> Did I miss something ? > >> The log shows that what I search for is being search for in the > >> database, but ONLY in the native columns. > >> > >> /S -- 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.
