Query Bind values with string keys

11 views
Skip to first unread message

Sampson Crowley

unread,
Jun 12, 2019, 2:23:43 PM6/12/19
to Ruby on Rails: Talk
Is it possible to use string keys for named query params? I have a very dynamic query builder for and Admin site, and I would like to avoid the extra memory use of permanently storing every key used as a symbol

Ariel Juodziukynas

unread,
Jun 12, 2019, 4:08:05 PM6/12/19
to rubyonra...@googlegroups.com
can you show an example of your code? you can always do "somestring" => "somevalue" instead of somestring: "somevalue"

El mié., 12 jun. 2019 a las 15:24, Sampson Crowley (<sampsons...@gmail.com>) escribió:
Is it possible to use string keys for named query params? I have a very dynamic query builder for and Admin site, and I would like to avoid the extra memory use of permanently storing every key used as a symbol

--
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/15e21d12-8d43-415c-8b19-5966ee93d22a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sampson Crowley

unread,
Jun 13, 2019, 11:41:35 AM6/13/19
to Ruby on Rails: Talk
Nope, you can't always just do that

SomeModel.where("my_column = :named", {"named" => "value"})

Doesn't work. You get a arg not found error

Reply all
Reply to author
Forward
0 new messages