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 Person #existing implementation | |
def find_by_name name | |
filter = adapter.create_equality_filter('uid', "*#{name}*") | |
results = find(:base => '', :attributes => attribute_mapping.values, :filter => filter) | |
build_array_of_people_from results | |
end | |
def find_by_exact_name name | |
filter = adapter.create_equality_filter('uid', "#{name}") | |
results = find(:base => '', :attributes => attribute_mapping.values, :filter => filter) | |
if (results.size > 1) |
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
def to_factory model | |
model.columns.each do |c| | |
if c.null == false | |
value = case c.type | |
when :integer | |
"7" | |
when :string | |
"'hi'" | |
when :boolean | |
'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
# Install admin_data | |
plugin 'admin_data', :git => 'git://github.com/alexrothenberg/admin_data.git' | |
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
# In DOS type | |
### cd \workshop | |
### mkdir ruby_exercises | |
### cd ruby_exercises | |
# Open the e editor | |
### e . | |
# Create a new file called array_exercise.rb |
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
# In DOS type | |
### cd \workshop | |
### mkdir ruby_exercises | |
### cd ruby_exercises | |
# Open the e editor | |
### e . | |
# Create a new file called hash_exercise.rb |
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
# In DOS type | |
### cd \workshop | |
### mkdir ruby_exercises | |
### cd ruby_exercises | |
# Open the e editor | |
### e . | |
# Create a new file called string_exercise.rb |
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
# In DOS type | |
### cd \workshop | |
### mkdir ruby_exercises | |
### cd ruby_exercises | |
# Open the e editor | |
### e . | |
# Create a new file called symbol_exercise.rb |
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
# test/unit/team_test.rb | |
require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'test_helper') | |
class TeamTest < ActiveSupport::TestCase | |
test 'can save a team in the database' do | |
team = Team.new(:name => 'Liverpool') | |
team.save! | |
team_from_database = Team.find(team.id) |
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
<h3>Create a New Team</h3> | |
<% form_for @team do |form| %> | |
<%= form.label :name %> | |
<%= form.text_field :name %> | |
<%= submit_tag %> | |
<% 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
def create | |
@team = Team.create!(params[:team]) | |
redirect_to team_url(@team) | |
end |
OlderNewer