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
| ary = [1,2,3,4,5,6] | |
| def reject(array) | |
| array.reject { |e| e == 3 } | |
| end | |
| reject(ary) | |
| puts "array: #{ary.join}" |
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 VisitReport < ActiveRecord::Base | |
| attr_accessible :comments, :attachments_attributes, :person_id, :person_name, | |
| :clients_visit_reports_attributes | |
| validates_presence_of :comments, :clients_visit_reports | |
| has_many :clients_visit_reports, :class_name => ClientsVisitReport | |
| accepts_nested_attributes_for :clients_visit_reports, :allow_destroy => true | |
| end |
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 ClientsVisitReport < ActiveRecord::Base | |
| attr_accessible :client_id, :client_type, :client_name | |
| belongs_to :client, :polymorphic => true | |
| belongs_to :visit_report | |
| end |
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
| desc "Deploys the current version to the server." | |
| task :deploy => :environment do | |
| deploy do | |
| invoke :'git:clone' | |
| invoke :'deploy:link_shared_paths' | |
| invoke :'bundle:install' | |
| invoke :'rails:db_migrate' | |
| invoke :'rails:assets_precompile' | |
| invoke :'deploy:cleanup' |
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
| - title t(".title") | |
| %div.pull-left.span6{:style => "margin-left: 0"} | |
| = form_for Person.new, :html => {:class => "validate"} do |f| | |
| %h3.subtitle=t(".new_client") | |
| %div.well.well-small | |
| %div.row-fluid | |
| = form_text_field(f, :name, "span12", :class => "required") | |
| %div.row-fluid | |
| = form_text_field(f, :cpf, "span12", :class => "cpf required") | |
| %div.row-fluid |
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
| # Mongoid Configuration | |
| # ===================== | |
| # | |
| # Copy this file to config/mongoid.yml and | |
| # modify it accordingly. This file will automatically | |
| # be copied to shared/config on the server when | |
| # `cap deploy:setup` is ran the first time. Be sure | |
| # to place production specific settings there | |
| defaults: &defaults |
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
| def comercial(user) | |
| can [:manage], Account, :officer_id => user.id | |
| can [:manage], Account, :co_officer_id => user.id | |
| can :read, [Balance, HistoricBalance], :account => { :officer_id => user.id } | |
| can :read, [Balance, HistoricBalance], :account => { :co_officer_id => user.id } | |
| can [:manage], Person, :accounts => { :officer_id => user.id } | |
| can [:manage], Person, :accounts => { :co_officer_id => user.id } | |
| can [:read], Documentation do |documentation| | |
| can?(:read, documentation.account) | |
| end |
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
| $('[rel=pretty-file] a.btn').bind 'click', -> | |
| $(this).parent().find("input[type=file]:first").click() | |
| return false | |
| $("[rel=pretty-file] input[type=file]").bind 'change', -> | |
| $(this).parent().find("input:last").val($(this).val()) |
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
| def form_file_field(form, attr, options = {}) | |
| options[:class] ||= "" | |
| options[:class] += " span12" unless options[:class].include?("span") | |
| content_tag :div, :class => "input-append", "rel" => "pretty-file" do | |
| form.file_field(attr, :class => "hide") + | |
| text_field(:file, attr, :class => "disabled #{options[:class]}") + | |
| link_to(t("browse"), "#", :class => "btn") | |
| end | |
| end |
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
| - title Portfolio.model_name.human | |
| = form_for @portfolio, :html => {:multipart => true, :class => "validate"} do |f| | |
| %div.row-fluid | |
| = form_text_area f, :comments, "span12", :style => "height: 90px;" | |
| = f.fields_for :attachments do |sub| | |
| = sub.file_field :file | |
| %div.form-actions | |
| %button.send=t(:save) |