Created
December 21, 2012 15:18
-
-
Save milushov/4353416 to your computer and use it in GitHub Desktop.
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
# encoding: utf-8 | |
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
before_filter :set_temp_attachable_id, :prepare | |
private | |
def prepare | |
@categories = Category.all | |
@team = User.public.limit(4) | |
@special_objects = RealtyObject.special.limit(12) | |
@layout_options = { | |
header_fixed: false, | |
header_menu: true | |
} | |
@temp_attachable_id = session[:temp_attachments][:attachable_id] | |
end | |
def set_temp_attachable_id | |
if request.env['REQUEST_METHOD'] == 'GET' | |
session[:temp_attachments] = { | |
attachable_id: rand(-2_000_000..-1_000_000), | |
attachments_ids: [] | |
} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment