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
var states = [ | |
'showingAddRelative', | |
'showingForm', | |
'showingComplexRelationshipHelp', | |
'findingExistingRelatives', | |
'choosingNewOrExisting', | |
'addingRelative', | |
'gettingSuggestions', | |
'showingSuggestions', | |
'approvingSuggestions', |
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
#!/usr/bin/env ruby | |
require 'yard' | |
require 'json' | |
# Replace YARD's default with our own | |
template_path = File.expand_path(File.dirname(__FILE__) + "/templates") | |
YARD::Templates::Engine.template_paths = [template_path] | |
YARD::Registry.load(Dir["rails/act*/lib/**/*.rb"]) |
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 Company < ActiveRecord::Base | |
###company validation | |
validates_presence_of :company_name, :message => "Company Name is required!", :unless => :user_name_present? | |
def user_name_present? | |
self.user_name.present? | |
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 self.all | |
results = [] | |
ObjectSpace.each_object(Class) do |c| | |
(results << c) if c < PullSource | |
end | |
results | |
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
resources :meetings, :only => [:index] do | |
resources :bookings | |
end | |
resources :bookings |
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
gem 'cramp' | |
gem 'erubis', '2.6.5' | |
gem 'usher', "0.6.0" |
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
When you want to create an object and save it in one fell swoop, you can use the create method. Use it now to create another article: | |
>> Article.create(:title => "Some Fancy Title") | |
=> #<Article id: 4, title: "Some Fancy Title" > | |
Instead of returning true or false, the create method returns the object it created - in this case, an Article object. You're actually passing a hash of attributes to the create method. Although hashes are normally surrounded by curly braces, when a hash is only argument to a Ruby method, the braces are optional. You can just as easily create the attributes hash first and then give that to create: | |
>> attributes = { :titile => "Some other Fancy Title } | |
>> Article.create(attributes) | |
=> #<Article id: 5, title: "Some other Fancy Title" > |
NewerOlder