You were right, I apologize.
> On Jun 25, 2015, at 10:41 AM, Matias Korhonen <korhonen.m...@gmail.com> wrote: > > You do not need to pass all the arguments inside of an array, the correct > syntax is: > Post.find_by_sql("SELECT * FROM posts WHERE id = ?", 1) > > I wonder if you actually tried that in console? Because I did, with this > result: > > [1] pry(main)> Post.find_by_sql("SELECT * FROM posts WHERE id = ?", 1) > NoMethodError: undefined method `empty?' for 1:Fixnum > from > /Users/matt/.rvm/gems/ruby-2.2.1/gems/activerecord-4.1.10/lib/active_record/connection_adapters/abstract_adapter.rb:389:in > `without_prepared_statement?' > > > You should have a deeper understanding of the advanced parts of Ruby (like > splats) before moving into Rails. > > Having used Ruby professionally for the past five years or so, I have pretty > good understanding of basic Ruby behaviour (like splats), so your snark is > unwarranted (and not a good way to make people feel wanted in this community). > > > So in this case I would say that the correct documentation should be: > find_by_sql(sql, *binds = []) > > Except that's not what the method definition actually is. There is no splat > in the definition > <https://github.com/rails/rails/blob/70d1b5a7f8e25b077168deaf592e0e58c3f2bdd1/activerecord/lib/active_record/querying.rb#L38-L52>. > If there was, the behaviour would be different (if it wasn't for the fact > that def find_by_sql(sql, *binds=[]) would be invalid ruby > <https://gist.github.com/matiaskorhonen/3e79c6bcf2df8fbc7eec>). > > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-core+unsubscr...@googlegroups.com > <mailto:rubyonrails-core+unsubscr...@googlegroups.com>. > To post to this group, send email to rubyonrails-core@googlegroups.com > <mailto:rubyonrails-core@googlegroups.com>. > Visit this group at http://groups.google.com/group/rubyonrails-core > <http://groups.google.com/group/rubyonrails-core>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.