Skip to content

Instantly share code, notes, and snippets.

View danielvlopes's full-sized avatar

Daniel Lopes danielvlopes

View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:StringValidator source="{nome}" property="text"
required="true"
minLength="4"
requiredFieldError="Campo obrigatório"
tooShortError="Valor preenchido é muito curto"
trigger="{nome}" triggerEvent="change"
valid="status.text='Nome é válido'"/>
<!--===========================================
VALIDADORES
=========================================== -->
<mx:StringValidator
id="tituloValidator"
source="{tiTitulo}"
property="text"
required="true"
requiredFieldError="Campo obrigatório"/>
//Função chamada no evento de CLICK do botão Cadastrar
private function cadastrarClickHandler():void{
var evTituloValid:ValidationResultEvent = tituloValidator.validate();
var evTextoValid :ValidationResultEvent = textoValidator.validate();
//valida os campos obrigatórios
if ((evTituloValid.type== ValidationResultEvent.VALID) &&
(evTextoValid.type == ValidationResultEvent.VALID))
Alert.show('Validações com sucesso, agora envie para o SERVER', 'Sucesso');
accounts GET /accounts {:controller=>"accounts", :action=>"index"}
formatted_accounts GET /accounts.:format {:controller=>"accounts", :action=>"index"}
POST /accounts {:controller=>"accounts", :action=>"create"}
POST /accounts.:format {:controller=>"accounts", :action=>"create"}
new_account GET /accounts/new {:controller=>"accounts", :action=>"new"}
formatted_new_account GET /accounts/new.:format {:controller=>"accounts", :action=>"new"}
edit_account GET /accounts/:id/edit {:controller=>"accounts", :action=>"edit"}
formatted_edit_account GET /accounts/:id/edit.:format {:controller=>"accounts", :action=>"edit"}
ActionController::Routing::Routes.draw do |map|
map.resources :accounts do |accounts|
accounts.resources :people
end
map.resources :notes, :path_prefix=>"people/:person_id", :name_prefix => "people_"
map.resources :comments, :path_prefix=>"notes/:note_id", :name_prefix => "note_"
#map.connect ':controller/:action/:id'
#map.connect ':controller/:action/:id.:format'
ActionController::Routing::Routes.draw do |map|
map.resources :accounts do |accounts|
accounts.resources :people
end
map.resources :notes, :path_prefix=>"people/:person_id", :name_prefix => "people_"
map.resources :comments, :path_prefix=>"notes/:note_id", :name_prefix => "note_"
#map.connect ':controller/:action/:id'
#map.connect ':controller/:action/:id.:format'
map.resources :accounts do |accounts|
accounts.resources :people, :name_prefix => "account_"
end
map.resources :people do |people|
people.resources :notes, :name_prefix => "person_"
end
map.resources :notes do |notes|
notes.resources :comments, :name_prefix => "note_"
accounts GET /accounts {:controller=>"accounts", :action=>"index"}
POST /accounts {:controller=>"accounts", :action=>"create"}
new_account GET /accounts/new {:controller=>"accounts", :action=>"new"}
edit_account GET /accounts/:id/edit {:controller=>"accounts", :action=>"edit"}
account GET /accounts/:id {:controller=>"accounts", :action=>"show"}
PUT /accounts/:id {:controller=>"accounts", :action=>"update"}
DELETE /accounts/:id {:controller=>"accounts", :action=>"destroy"}
account_people GET /accounts/:account_id/people {:controller=>"people", :action=>"index"}
# use => ruby rename.rb .jpg thumb_
def generate
files = Dir.entries(".")
count = 1
files.each do |f|
extension = f[/\.[a-z]+$/]
if extension == ARGV[0]
new_name = "#{ARGV[1]}#{count.to_s}#{extension}"
# use => ruby rename.rb .jpg thumb_
def generate
files = Dir.entries(".")
count = 1
files.each do |f|
extension = f[/\.[a-z]+$/]
if extension == ARGV[0]
new_name = "#{ARGV[1]}#{count.to_s}#{extension}"