Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Martin Markech
refinerycms-news
Commits
bb22f2a0
Commit
bb22f2a0
authored
Jun 21, 2012
by
Uģis Ozols
Browse files
Use range to produce "BETWEEN" query.
parent
51b39a59
Changes
1
Show whitespace changes
Inline
Side-by-side
app/models/refinery/news/item.rb
View file @
bb22f2a0
...
...
@@ -35,11 +35,11 @@ module Refinery
class
<<
self
def
by_archive
(
archive_date
)
where
(
[
'
publish_date
between ? and ?'
,
archive_date
.
beginning_of_month
,
archive_date
.
end_of_month
]
)
where
(
:
publish_date
=>
archive_date
.
beginning_of_month
..
archive_date
.
end_of_month
)
end
def
by_year
(
archive_year
)
where
(
[
'
publish_date
between ? and ?'
,
archive_year
.
beginning_of_year
,
archive_year
.
end_of_year
]
)
where
(
:
publish_date
=>
archive_year
.
beginning_of_year
..
archive_year
.
end_of_year
)
end
def
all_previous
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment