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
07 > (@paitent.date_of_birth).to_date | |
=> Thu, 03 Mar 2011 | |
ruby-1.9.2-p136 :008 > (@paitent.date_of_birth).to_date == Date.today | |
=> true | |
ruby-1.9.2-p136 :009 > (@paitent.date_of_birth).to_date == Date.yesterday | |
=> true | |
ruby-1.9.2-p136 :010 > (@paitent.date_of_birth).to_date == Date.tomorrow | |
=> false |
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
class DateOfBirthValidator < ActiveModel::Validator | |
def validate(record) | |
record.errors[:date_of_birth] << "Date Of Birth can not be set for a future date!" | |
end | |
private | |
def check(record) | |
(record.date_of_birth < Date.current) | |
end |
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
class Phone < ActiveRecord::Base | |
belongs_to :phonable, :polymorphic=>true | |
acts_as_audited | |
validates_presence_of :number | |
before_validation :parse_phone | |
def parse_phone | |
if self && self.number !=nil | |
number = self.number.gsub(/\D/,"") | |
if number.length == 10 |
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
require 'test_helper' | |
class PatientsControllerTest < ActionController::TestCase | |
setup do | |
@patient = patients(:one) | |
end | |
test "actions without user" do | |
PatientsController.action_methods.each do |action| | |
get action |
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
require 'test_helper' | |
class PatientsControllerTest < ActionController::TestCase | |
setup do | |
@patient = patients(:one) | |
activate_authlogic | |
end | |
test "patient actions without user" do | |
PatientsController.action_methods.each do |action| |
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
require 'test_helper' | |
class AddressesControllerTest < ActionController::TestCase | |
setup do | |
@address = addresses(:of_patient) | |
@patient = patients(:one) | |
activate_authlogic | |
end | |
test "patient addresses index without user" do |
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
@import <CappuccinoResource/CRBase.j> | |
@implementation UserSession : CappuccinoResource | |
{ | |
CPString login @accessors; | |
CPString password @accessors; | |
} | |
- (JSObject)attributes | |
{ | |
return {"user_session":{"login":login, "password":password}}; |
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
- (void)doLogin:(id)sender | |
{ | |
var UserSession = { | |
"user_session" : { | |
"login" : [LoginUserName objectValue], | |
"password" : [LoginPassword objectValue], | |
"remember_me" : false | |
} | |
}; | |
var request = [[CPURLRequest alloc] initWithURL:[CPURL URLWithString: @"/user_sessions"]]; |
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
/* | |
* AppController.j | |
* Cloud-MD | |
* | |
* Created by You on March 8, 2011. | |
* Copyright 2011, Your Company All rights reserved. | |
*/ | |
@import <Foundation/CPObject.j> |
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
@import <Foundation/CPObject.j> | |
@import "UserSessionController.j" | |
@implementation AppController : CPObject | |
{ | |
CPWindow mainWindow; //this "outlet" is connected automatically by the Cib | |
CPToolbar toolbar; | |
CPToolbarItem toolItemSearch; | |
CPToolbarItem toolItemUserName; |
OlderNewer