Search

7 views
Skip to first unread message

Daynthan Kabilan

unread,
Dec 24, 2013, 1:45:28 AM12/24/13
to rubyonra...@googlegroups.com
Hi all,

how to avoid single quote in our rails search

Example

in my users table  user_name=ram'kumar

my search query

params[:name]=ramkumar

@ans=Users.where("user_name=?",params[:name])

how can i get the value?

any one give me a solution


Thankyou.

Rob Biedenharn

unread,
Dec 24, 2013, 2:08:18 AM12/24/13
to rubyonra...@googlegroups.com
On 2013-Dec-24, at 01:45 , Daynthan Kabilan <dayan...@gmail.com> wrote:

Hi all,

how to avoid single quote in our rails search

Example

in my users table  user_name=ram'kumar

my search query

params[:name]=ramkumar

@ans=Users.where("user_name=?",params[:name])

@ans = User.where(user_name: params[:name])

and let the ActiveRecord gem sanitize the parameters

If you're not using the latest version of Rails, you'll need to give more specifics before you can get better help.

-Rob


how can i get the value?

any one give me a solution


Thankyou.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADKeJyRuuoBPCvs3-5MP8PJQLrLBWrdCVhPoj4K9UeSC9fxj5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages