# пользователь
class User < ActiveRecord::Base
has_many :bosses, through: :boss_assistants, :source => :user
has_many :assistans, through: :boss_assistants, :source => :user
end
# связь
class BossAssistant < ActiveRecord::Base
belongs_to :boss, :class_name => 'User', :foreign_key => 'boss_id'
belongs_to :assistant, :class_name => 'User', :foreign_key => 'assistant_id'
end
# Галерея
class Galery < ActiveRecord::Base
has_many :photos
accepts_nested_attributes_for :photos
end
#фотография
class Photo < ActiveRecord::Base
belongs_to :galery
# монтирование загрузчика :file -имя поля модели, где будет храниться имя файла
mount_uploader :file, FileUploader
end
# загрузчик
class FileUploader < CarrierWave::Uploader::Base
storage :file
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
end
<%= form_for @galery do |galery_form| %>
<!-- такие то поля для галереи --->
<%= galery_form.fields_for :photos, @photos do |photo_fields| %>
Изображение: <%= photo_fields.file_field :file %>
<% end %>
<% end %>
class MessagesController < WebsocketRails::BaseController
include ApplicationHelper
before_action do
Authlogic::Session::Base.controller = Authlogic::ControllerAdapters::RailsAdapter.new(self)
end
def cookies
request.cookies
end
def create
abort current_user.id.to_s
end
end
var all_points=[];
var paths=route.getPaths();
var i=0;
while(paths.get(i)!==null){
var p=paths.get(i);
var segments=p.getSegments();
$(segments).each(function(){
var pc=this.getCoordinates();
$(pc).each(function(){
all_points.push(this);
});
});
i++;
}