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 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 |
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 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) |
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
<script type="text/javascript"> | |
$(function() { | |
$('#thumbs').carouFredSel({ | |
synchronise: ['#images', false, true], | |
auto: false, | |
width: 440, | |
items: { | |
visible: 3, | |
start: -1 | |
}, |
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
<?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 |
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
<?php | |
// TaskController - actionCreate | |
function actionCreate() { | |
... | |
$this->raiseEvent('onTaskCreate', new CEvent($this)); | |
... | |
} | |
public function onTaskCreate($event) { |