View article.rb
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
View articles_controller.rb
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')
View articles_search.rb
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
View articles_controller.rb
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
View article.rb
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
View articles_controller.rb
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
View article.rb
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
View for_socpe.rb
def for_scope(scope, user = GuestUser.new)
case scope
when 'saved'
user.saved_articles.scoped
when 'my'
user.tagged_articles.scoped
else
scoped
end
end
View boolean_value.rb
class BooleanValue < Value
end
View HLPlaceResourceManager.h
//
// HLPlaceResourceManager.h
// HeyLets2
//
// Created by Alex Bush on 11/18/14.
// Copyright (c) 2014 HeyLets. All rights reserved.
//
#import <Foundation/Foundation.h>