-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into production
- Loading branch information
Showing
17 changed files
with
142 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,4 +74,5 @@ group :development do | |
gem 'mechanize' | ||
gem 'bullet' | ||
gem 'meta_request' | ||
gem 'rubocop', require: false | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,32 @@ | ||
class V3::TafsirsController < ApplicationController | ||
before_action :set_verse | ||
|
||
# GET /chapter_id/verses/verse_number/tafsirs | ||
def index | ||
chapter = Chapter.find(params[:chapter_id]) | ||
verse = chapter.verses.find(params[:verse_id]) | ||
tafsirs = verse.tafsirs.where(resource_content_id: params[:tafsirs]) | ||
|
||
tafsirs = @verse.tafsirs | ||
|
||
if tafirs_filter.present? | ||
tafsirs = tafsirs.where(resource_content_id: tafirs_filter) | ||
end | ||
|
||
render json: tafsirs | ||
end | ||
|
||
protected | ||
|
||
def chapter | ||
Chapter.find(params[:chapter_id]) | ||
end | ||
|
||
def set_verse | ||
@verse = chapter.verses.find_by_verse_number(params[:verse_id]) | ||
end | ||
|
||
def tafirs_filter | ||
return nil unless params[:tafsirs].present? | ||
|
||
ResourceContent.where(id: params[:tafsirs]) | ||
.or(ResourceContent.where(slug: params[:tafsirs])) | ||
.pluck(:id) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
if Rails.env.production? | ||
Raven.configure do |config| | ||
config.dsn = ENV['SENTRY_DSN'] | ||
config.environments = ['staging', 'production'] | ||
end | ||
Raven.configure do |config| | ||
config.dsn = ENV['SENTRY_DSN'] | ||
config.environments = ['staging', 'production'] | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class AddVerseKeyToTafsirs < ActiveRecord::Migration[5.0] | ||
def change | ||
add_column :tafsirs, :verse_key, :string | ||
add_index :tafsirs, :verse_key | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace :one_time do | ||
task fix_tafsir: :environment do | ||
Tafsir.includes(:verse).each do |tafsir| | ||
tafsir.update_attribute :verse_key, tafsir.verse.verse_key | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters