Skip to content

Instantly share code, notes, and snippets.

class User < ActiveRecord::Base
attr_accessor :password
has_many :groups
validates_presence_of :email, :message => '.validates_presence_of_email'
validates_presence_of :password, :message => '.validates_presence_of_password'
#authorization and registration in this method
def self.get_authorized_user params
user = self.first :conditions => { :encrypted_password => encrypte( params[ :password ] ), :email => params[ :email ] }
return user if !!user
class Branch < ActiveRecord::Base
belongs_to :company
belongs_to :point_shape
belongs_to :poly_shape
#has_one :style, :through => :point_shape
define_index do
indexes company.name, :as => :company
indexes poly_shape.houses.name, :as => :house
indexes poly_shape.houses.street.name, :as => :street
class PointShapesController < ApplicationController
caches_page :branches
def branches
respond_to{ |format|
valid_tile = Tile.valid_tile(params[:id])
raise HTTPStatus::NotFound if valid_tile.nil?
class A
def a
puts 'a'
end
end
class B<A
def a
super()
puts 'b'
Container = function( el ){
var
me = {
el:el,
win: $( window )
}
return me
}
Panel = function( el, params ){
#encoding: utf-8
#Программа написана для ruby 1.9.2
def get_next seq
puts next_seq = seq.split('').inject( [] ){ |s,w|
if s[-1].nil? || s[-1][1] != w
s << [1,w]
else
s[-1][0]+=1
end
s
module A
def a_xx
end
end
module B
def b_xx
end
end
module A
def a_xx
end
end
module B
def b_xx
end
end
Sample = function( el )
{
//mixins
var me = Container( el )
//params
//,v1 = ...
//...
//dom elements
@Talleyran
Talleyran / layer_spec.rb
Created October 30, 2011 10:47
spec для описания модели Layer
require 'spec_helper'
def valid_layer_attributes
{ structure: {
f1: :array,
f2: :big_decimal,
f3: :boolean,
f4: :date,
f5: :date_time,
f6: :float,