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 count_frequency(word_list) | |
| counts = Hash.new(0) | |
| for word in word_list | |
| counts[word] += 1 | |
| end | |
| counts | |
| 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
| person = WellnessScreening.find_by_sql("SELECT FROM wellness_screenings AS ws | |
| INNER JOIN wellness_policies AS wp | |
| ON wp.payor_number = wellness_screenings.employee_id | |
| AND wp.policy_type = wellness_screenings.policy") |
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
| ActiveRecord::Base.establish_connection( | |
| :adapter => "mysql", | |
| :user => "root", | |
| :password => "", | |
| :database => "arvest" | |
| ) | |
| class Employee < 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
| <person> | |
| ...... | |
| ...... | |
| ...... | |
| </person> | |
| <person> | |
| ...... | |
| ...... | |
| ...... | |
| </person> |
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
| $(document).ready(function(){ | |
| $("a.tab").live('click', function () { | |
| $(".content").hide(); | |
| $("ul.tabs .active").removeClass("active"); | |
| $(this).addClass("active"); | |
| $("#" + $(this).attr("title")).show(); | |
| }); |
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
| = form_for [@ticketable, Ticket.new] do |f| | |
| = f.error_messages | |
| %p | |
| = f.label :title, "Brief Title for Issue" | |
| = f.text_field :title | |
| %p | |
| = f.label :call_type | |
| %br/ | |
| = f.select :call_type, Ticket::Types.collect { |t| [t.first.to_s, t.last] } | |
| #ticket_priority_field.field |
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 new | |
| @ticket = Ticket.find(:id) | |
| @company = Company.new(:app => @ticket) | |
| respond_to do |format| | |
| format.html # new.html.erb | |
| format.xml { render :xml => @company } | |
| 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
| def create | |
| @ticket = Ticket.new(params[:ticket]) | |
| @user = current_user | |
| if @ticket.save | |
| redirect_to [@ticket.ticketable, @ticket], :notice => 'Ticket was created successfully' | |
| else | |
| flash[:notice] = 'Ticket was not created Successfully.' | |
| render = 'new' | |
| 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
| ## Evan-Sparkmans-Mac-mini | ruby-1.9.2-p136@rails3 | Rails 3.0.3 [~/Programming/Rails/clientmanager] ∴ rails c | |
| Loading development environment (Rails 3.0.3) | |
| ruby-1.9.2-p136 :001 > t = Ticket.new(:ticketable => Company.find(3)) | |
| => #<Ticket id: nil, call_type: nil, priority_level: nil, description: nil, call_back_needed: nil, ticketable_id: 3, ticketable_type: "Company", user_id: nil, status: nil, created_at: nil, updated_at: nil, title: nil> | |
| ruby-1.9.2-p136 :002 > t.ticketable_id | |
| => 3 | |
| ruby-1.9.2-p136 :003 > t.ticketable_type | |
| => "Company" | |
| ruby-1.9.2-p136 :004 > t.ticketable_id.na | |
| t.ticketable_id.name t.ticketable_id.name= t.ticketable_id.name? |
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 CompaniesController < ApplicationController | |
| # GET /companies | |
| # GET /companies.xml | |
| def index | |
| @companies = Company.all | |
| respond_to do |format| | |
| format.html # index.html.erb | |
| format.xml { render :xml => @companies } | |
| end |