Skip to content

Instantly share code, notes, and snippets.

View waaadim's full-sized avatar

Vadim Rihlea waaadim

  • Chisinau, Moldova
View GitHub Profile
class Country < ActiveRecord::Base
validates :name, uniqueness: true
validates :name, presence: true
has_many :regions, dependent: :destroy#, inverse_of: :country
validates_associated :regions
accepts_nested_attributes_for :regions
end
class Region < ActiveRecord::Base
class SessionsController < Devise::SessionsController
# skip_before_filter :require_no_authentication
def create
# raise user_signed_in?.inspect
self.resource = warden.authenticate!(auth_options)
set_flash_message(:notice, :signed_in) if is_flashing_format?
resource.authentication_token = nil
resource.save!
sign_in(resource_name, resource)
<script type="text/javascript">
$(function() {
$('#thumbs').carouFredSel({
synchronise: ['#images', false, true],
auto: false,
width: 440,
items: {
visible: 3,
start: -1
},
<?php
/*
isEnabled() (example):
let's pretend that you have a folder "web_root/module" and in that folder the following files:
Model1.php
Model2.php
Model3.php
Model4.php
<?php
// TaskController - actionCreate
function actionCreate() {
...
$this->raiseEvent('onTaskCreate', new CEvent($this));
...
}
public function onTaskCreate($event) {