This file contains hidden or 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 Mixin::ContentFilter | |
extend ActiveSupport::Concern | |
included do | |
scope :by_creation, order("#{ name.tableize }.created_at DESC") | |
scope :recent, -> { where{ created_at >= 7.days.ago } } | |
end | |
module ClassMethods | |
def top_items(limit = nil) |
This file contains hidden or 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
#! /bin/sh | |
# BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 |
This file contains hidden or 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
[apsadmin@www ~]$ ps aux | grep http | |
root 1319 0.0 0.0 240636 788 ? Ss 03:43 0:03 /usr/sbin/httpd | |
apache 1380 0.0 0.1 240932 3216 ? S 03:43 0:00 /usr/sbin/httpd | |
apache 9964 0.0 0.1 241348 3376 ? S 10:24 0:00 /usr/sbin/httpd | |
apache 11064 0.0 0.0 240960 1144 ? S 11:05 0:00 /usr/sbin/httpd | |
apache 11262 0.0 0.0 240944 1500 ? S 11:12 0:00 /usr/sbin/httpd | |
apache 11639 0.0 0.0 240944 332 ? S 11:31 0:00 /usr/sbin/httpd | |
apache 11671 0.0 0.0 240940 364 ? S 11:32 0:00 /usr/sbin/httpd | |
apache 11672 0.0 0.1 241216 2844 ? S 11:32 0:00 /usr/sbin/httpd | |
apache 11734 0.0 0.1 240880 3272 ? S 11:34 0:00 /usr/sbin/httpd |
This file contains hidden or 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
def self.add_before_filter(controller_class, method, *args) | |
options = args.extract_options! | |
resource_name = args.first | |
before_filter_method = options.delete(:prepend) ? :prepend_before_filter : :before_filter | |
controller_class.send(before_filter_method, options.slice(:only, :except, :if, :unless)) do |controller| | |
controller.class.cancan_resource_class.new(controller, resource_name, options.except(:only, :except, :if, :unless)).send(method) | |
end | |
end |
This file contains hidden or 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 Group::InvitationsController < ApplicationController | |
load_resource :group | |
before_filter :authorize_invitations, only: [:new, :create] | |
def new | |
already_invited_user_ids = @group.group_invitations.by_user(current_user).pluck(:invitee_id) | @group.user_ids | |
@to_invite = { friends: current_user.friends.includes(:profile), | |
followers: current_user.followers.includes(:profile), | |
without_ids: already_invited_user_ids } | |
end |
This file contains hidden or 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 ContentItemsController < ApplicationController | |
before_filter :init_resource, :authorize_content_item | |
def index | |
@popular_content_items = ContentItem.search_with_filter(params). | |
sx_active.sx_ordered("votes_count") | |
if params[:category_id].blank? | |
if signed_in? | |
@friends_content_items = ContentItem.search_with_filter(params). |
This file contains hidden or 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 Event::InvitationsController < ApplicationController | |
load_resource :event | |
before_filter :authorize_resource | |
def new; end | |
def create | |
unless params[:users_to_invite].blank? | |
ids = { groups: [], users: [] } |
This file contains hidden or 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
create_table "groups", :force => true do |t| | |
t.string "name" | |
t.text "description" | |
t.string "access_type" | |
t.integer "creator_id" | |
t.datetime "created_at", :null => false | |
t.datetime "updated_at", :null => false | |
t.string "membership_approval", :default => "all", :null => false | |
t.string "posting_permission", :default => "all", :null => false | |
t.boolean "fan_zone", :default => false |
This file contains hidden or 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 CurrentUser::ContentSets::ContentItemsController < InheritedResources::Base | |
belongs_to :content_set | |
private | |
def begin_of_association_chain | |
current_user | |
end | |
end |
This file contains hidden or 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
β engine git:(master) curl -X POST http://new.private-tutor.ru/entry_submissions/orders.json | |
{"errors":{"_slug":["can't be blank"],"name":["can't be blank"],"phone":["can't be blank"],"email":["can't be blank"]}}% | |
β engine git:(master) curl -X POST --data "content[name]=a&content[email]=a&content[phone]=a" http://new.private-tutor.ru/entry_submissions/orders.json | |