Ruby on Rails Developers Forum

For all Ruby on Rails (RoR) Expert Developers Programmers Coders
Ruby on Rails PHP .Net Developers Community, Nyros Technologies, Kakinada
 
Log in  or IF not a member please REGISTER
Username:
Password:   


Keyword
Log in | Profile 

rd_searchlogic gem for search using conditions on column

 
Post new topic   Reply to topic    Ruby on Rails Developers Forum Index -> Plugins and Gems
View previous topic :: View next topic  
Author Message
konduri subrahmanyam



Joined: 12 May 2011
Posts: 88

PostPosted: Sat Feb 18, 2012 6:05 am    Post subject: rd_searchlogic gem for search using conditions on column Reply with quote

Hi,

In rails 3, we can use "rd_searchlogic" gem for making search using conditions on column.

Generally, we will find data in rails as "Model.find() or Model.find_by_column or Model.where()".

But, using the "rd_searchlogic" gem, we can find the records searchlogics as follows:

1) Adding gem to Gemfile:

gem 'rd_searchlogic', :require => 'searchlogic', :git => 'git://github.com/railsdog/searchlogic.git'

2) Using gem:

For example I have taken the "Post" model and "name:string, title:string, content:text" as fields of that model.

Now, we can call methods on "Post" as follows:

a) To find records having "title" as "rails":
@posts = Post.title_like("rails")

b) To find records having "name" ending with "ruby"
@posts = Post.name_ends_with("ruby")

c) To find records having "content" data not as null:
@posts = Post.content_not_null

d) To find records having "name" as "ruby" and having record "id" lessthan or equal to "10":
@posts = Post.name_like("ruby").id_less_than_or_equal_to(10)


And in this way, we can find the records that we need with a less effort using "rd_searchlogic" gem.

For more details refer to the following url:
https://github.com/binarylogic/searchlogic

Thanks and Regards,
K. Subrahmanyam.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ruby on Rails Developers Forum Index -> Plugins and Gems
Page 1 of 1

 latest topics 
 Topics   Replies   Author   Views   Last Post 
No new posts PROBLEMS CREATING AN SSH TUNNEL
0 clem_c_rock 7915 Tue May 07, 2013 6:18 pm
clem_c_rock View latest post
No new posts Module Control
0 mpiaser 806 Sun May 05, 2013 4:12 am
mpiaser View latest post
No new posts Difficulty in learning ruby and rails
8 moneysharma 5882 Sat Apr 20, 2013 6:37 am
lucyming View latest post
No new posts Implementing SEO in rails
1 Rohini Pamarty 3103 Sat Apr 20, 2013 6:36 am
lucyming View latest post
No new posts RVM installation on ubuntu 10.04 version.
2 konduri subrahmanyam 3995 Sat Apr 20, 2013 6:35 am
lucyming View latest post
No new posts How to connect to remote databases in Ruby ?
1 ranjit_nyros 2756 Tue Apr 16, 2013 7:50 am
liveproject101 View latest post
No new posts Install Safari & IE in Ubuntu
2 Anu Krishna 3526 Thu Apr 04, 2013 6:52 am
chrisluger2012 View latest post
No new posts Saving the files in a zip folder using "rubyzip"
0 ranjit_nyros 5490 Thu Mar 14, 2013 5:23 pm
ranjit_nyros View latest post
No new posts [SOLVED]: A must after the installation of phpmyadmin
0 ranjit_nyros 1530 Thu Mar 14, 2013 4:52 pm
ranjit_nyros View latest post
No new posts Cropping Images with Carrierwave + rmagick
0 ranjit_nyros 1455 Thu Mar 14, 2013 4:37 pm
ranjit_nyros View latest post




Hire an expert Ruby on Rails developer / coder / programmer or development team from India now!!

Other Forums : PHP   ::   .Net   |   Free unlimited HTML CSS templates download

Nyros Technologies   |   Kakinada City Portal   |   Developers Blog   |   About Ruby on Rails Experts   |   More