I 날짜를 큰 이상의 특정 날짜 또는 보다 작거나 심지어 .this 인 arel와 두 간의 지정된 날짜를 날짜 싶어 내 컨트롤러 :레일 방법 사이 arel하고있다 LT와 날짜 쿼리를 얻기
@from_time = search[:value][:from_time]
@to_time = search[:value][:to_time]
letters_query = letters[@key].between(@[email protected]_time)
@letters = Letter.joins(:official).where(letters_query)
는이 내가 내 컨트롤러에 전달하는 JSON입니다
Parameters: {"query"=>{"search"=>{"0"=>{"key"=>"letter_date", "value"=>{"from_time"=>"01/09/1395", "to_time"=>"30/09/1395"}, "type"=>"date"}}}}
필자는 매개 변수를 얻는 것에 대해 확신하지만 내 날짜는 태양 종류라고 기록됩니다.
If you are passing user input to a predicate, you must either give an appropriate type caster object to the `Arel::Table`, or manually cast the value before passing it to Arel.
DEPRECATION WARNING: Passing a column to `quote` has been deprecated. It is only used for type casting, which should be handled elsewhere. See https://github.com/rails/arel/commit/6160bfbda1d1781c3b08a33ec4955f170e95be11 for more information. (called from p at /home/afsane/Desktop/Afsane Development/Production/isecretariat/app/controllers/searches_controller.rb:511)
DEPRECATION WARNING: table_exists? is deprecated and will be removed from Rails 5.1 (use #data_source_exists? instead) (called from p at /home/afsane/Desktop/Afsane Development/Production/isecretariat/app/controllers/searches_controller.rb:511)
Arel performing automatic type casting is deprecated, and will be removed in Arel 8.0. If you are seeing this, it is because you are manually passing a value to an Arel predicate, and the `Arel::Table` object was constructed manually. The easiest way to remove this warning is to use an `Arel::Table` object returned from calling `arel_table` on an ActiveRecord::Base subclass.
If you're certain the value is already of the right type, change `attribute.eq(value)` to `attribute.eq(Arel::Nodes::Quoted.new(value))` (you will be able to remove that in Arel 8.0, it is only required to silence this deprecation warning).
You can also silence this warning globally by setting `$arel_silence_type_casting_deprecation` to `true`. (Do NOT do this if you are a library author)
If you are passing user input to a predicate, you must either give an appropriate type caster object to the `Arel::Table`, or manually cast the value before passing it to Arel.
greated하게 대한 나는이 사용하는 작은 : 나는이 많이 테스트하고 모든 문제가이 라인 함께
letters_query = officials[@key].lt(@to_time)
letters_query = officials[@key].gt(@from_time)
을 :
@letters = Letter.joins(:official).where(letters_query)
는이 오류를 반환 아이디어가 있습니까?
'문자 [@key]'무엇인가? –
Key는 예 : letters [: created_at]의 컬럼 이름입니다. @JagdeepSingh –
쿼리가 다음과 같이 나타나야합니다. letters [: letter_date] .gt (Date.new (2016,10,20)) 그러나 문제는 내 날짜는 태양이 아닌 기독교 달력이야! 어떻게해야합니까? –