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
class Article < ActiveRecord::Base | |
include Categorizable | |
APPROVED = 'approved' | |
PENDING = 'pending' | |
REJECTED = 'rejected' | |
attr_accessible :approved_at, :url, :body, :image, :rating, :state, :title | |
validates :url, :uniqueness => true |
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
class Api::Private::ArticlesController < Api::Private::BaseController | |
before_filter :find_or_create_article, except: [:index] | |
def index | |
@articles = Article.scoped | |
if params[:state] == Article::PENDING | |
@articles = Article.pending.order(:published_at) | |
elsif params[:state] == Article::APPROVED | |
@articles = Article.approved.order('approved_at DESC') |
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
module ArticlesSearch | |
def articles_search(search_criteria, state = nil) | |
@articles = Article.includes(:categories).where('title LIKE ? OR categories.name LIKE ?', "%#{search_criteria}%", "%#{search_criteria}%") | |
if state | |
@articles = @articles.where(state: state) | |
end | |
@articles |
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
class Api::Private::ArticlesController < Api::Private::BaseController | |
include ArticlesSearch | |
before_filter :find_or_create_article, except: [:index] | |
PAGE_SIZE = 20 | |
def index | |
@articles = Article.scoped | |
total_pages = 0 | |
page = params[:page] ? params[:page] : 1 |
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
class Article < ActiveRecord::Base | |
include Categorizable | |
APPROVED = 'approved' | |
PENDING = 'pending' | |
REJECTED = 'rejected' | |
attr_accessible :approved_at, :url, :body, :image, :rating, :state, :title, :news_source_id, :published_at | |
validates :url, :uniqueness => true |
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
class Api::Private::ArticlesController < Api::Private::BaseController | |
include ArticlesSearch | |
before_filter :find_or_create_article, except: [:index] | |
PAGE_SIZE = 20 | |
attr_accessor :total_pages | |
def index | |
@articles = Article |
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
class Article < ActiveRecord::Base | |
include Categorizable | |
APPROVED = 'approved' | |
PENDING = 'pending' | |
REJECTED = 'rejected' | |
attr_accessible :approved_at, :url, :body, :image, :rating, :state, :title, :news_source_id, :published_at | |
validates :url, :uniqueness => true |
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
class BooleanValue < Value | |
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
// | |
// HLPlaceResourceManager.h | |
// HeyLets2 | |
// | |
// Created by Alex Bush on 11/18/14. | |
// Copyright (c) 2014 HeyLets. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
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
RAILS_ENV=development lib/daemons/mailer_ctl start | |
RAILS_ENV=development lib/daemons/mailer_ctl stop |
OlderNewer