I''ve been experimenting with Rails over the past couple of days and have come across something that seems harder than it should be. In previous frameworks I have used (WebObjects, php) a full search page (which leads into a list view populated with search results) was part of the CRUD that was either dynamically or statically created after specifying table/object schema. In WebObjects this was a very cool feature of DTW (direct to web), in php I rolled my own crud generator with searching capabilities even though I''m sure plenty exist already. I''ve looked through the archives and google and have found mentions of the lack of a search page in Rails, but as yet no solutions. I''m wondering if there are any plugins or scaffolding enhancements that add a search page to the basic CRUD interface. I''m not looking for a full text search just an interface that provides a form containing all table fields that, once submitted, builds a database query and returns the results. TIA, Dan
I''m also looking for a search scaffold plugin... anybody? On 7/28/06, Dan Stark <dstark@mac.com> wrote:> > I''ve been experimenting with Rails over the past couple of days and > have come across something that seems harder than it should be. In > previous frameworks I have used (WebObjects, php) a full search page > (which leads into a list view populated with search results) was part > of the CRUD that was either dynamically or statically created after > specifying table/object schema. In WebObjects this was a very cool > feature of DTW (direct to web), in php I rolled my own crud generator > with searching capabilities even though I''m sure plenty exist already. > > I''ve looked through the archives and google and have found mentions > of the lack of a search page in Rails, but as yet no solutions. I''m > wondering if there are any plugins or scaffolding enhancements that > add a search page to the basic CRUD interface. I''m not looking for a > full text search just an interface that provides a form containing > all table fields that, once submitted, builds a database query and > returns the results. > > TIA, > Dan > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060807/d91b4e57/attachment.html
Shimon Amit wrote:> I''m also looking for a search scaffold plugin... anybody? > >...and I was thinking of exactly this a while back... and was going to post to the list asking about it at night... :D Thanks for asking for me... Cheers Mohit.
The "Rails Recipes" book has something that could help... a generic model search...from there to a plugin it should be a short way... 2006/8/7, Mohit Sindhwani <mo_mail@onghu.com>:> > Shimon Amit wrote: > > I''m also looking for a search scaffold plugin... anybody? > > > > > ...and I was thinking of exactly this a while back... and was going to > post to the list asking about it at night... :D > Thanks for asking for me... > Cheers > Mohit. > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Michael Siebert <info@siebert-wd.de> www.stellar-legends.de - Weltraum-Browsergame im Alpha-Stadium -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060807/89874654/attachment.html
Thanks Michael, Actually, that was the reason I had scheduled to ask at night.. cos I planned to take a look at the Recipes book before posting my question.. I think AWDWR2 does not really go into this aspect in much detail... Cheers Mohit. Michael Siebert wrote:> The "Rails Recipes" book has something that could help... a generic > model search...from there to a plugin it should be a short way... > > 2006/8/7, Mohit Sindhwani <mo_mail@onghu.com <mailto:mo_mail@onghu.com>>: > > Shimon Amit wrote: > > I''m also looking for a search scaffold plugin... anybody? > > > > > ...and I was thinking of exactly this a while back... and was > going to > post to the list asking about it at night... :D > Thanks for asking for me... > Cheers > Mohit. >
Mohit Sindhwani wrote:> Thanks Michael, > > Actually, that was the reason I had scheduled to ask at night.. cos I > planned to take a look at the Recipes book before posting my question.. > I think AWDWR2 does not really go into this aspect in much detail... > > Cheers > Mohit.this may be completely off, but here is an article on creating a live search with sortable table columns and pagination: http://dev.nozav.org/rails_ajax_table.html i''ve used it in a few smaller projects and the search part might be of some use. -- Posted via http://www.ruby-forum.com/.
well, for me, this takes two lines of code def search @items_pages, @items = paginate ''Item'', :conditions => [''name LIKE ?'', params[:search_text]], :per_page => 10 render :action => :list end so you reuse the list view ___________ Heri http://sprinj.com On 8/7/06, Shimon Amit <shimon.amit@gmail.com> wrote:> > I''m also looking for a search scaffold plugin... anybody? > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060807/df709f0b/attachment.html
Thomas, Mark - BLS CTR
2006-Aug-08 12:44 UTC
[Rails] Building a Search Page as part of CRUD
heri rakotomalala wrote:> well, for me, this takes two lines of code > def search > @items_pages, @items = paginate ''Item'', :conditions => [''name LIKE ?'',params[:search_text]], :per_page => 10> render :action => :list > endIsn''t that vulnerable to SQL Injection attacks?
Nope -- the placeholder will be safely replaced by whatever string there is in params[:search_text] -----Original Message----- From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Thomas, Mark - BLS CTR Sent: Tuesday, August 08, 2006 1:45 PM To: rails@lists.rubyonrails.org Subject: RE: [Rails] Building a Search Page as part of CRUD heri rakotomalala wrote:> well, for me, this takes two lines of code def search @items_pages, > @items = paginate ''Item'', :conditions => [''name LIKE ?'',params[:search_text]], :per_page => 10> render :action => :list > endIsn''t that vulnerable to SQL Injection attacks? _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails