Skip to content

Episode 8 pull request - Tiger Level #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions theweb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@
@the_number = rand(number_as_string)
erb :number
end

post '/about' do
ryan_facts = ['Chuck Norris wears a Ryan Moser jersey',
'Ryan is likely to have a squid on his head',
'Ryan likes to do math for fun and profit',
'The creature Ryan most resembles is a box turtle']
@ryan_fact = ryan_facts[rand( ryan_facts.length )]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out this awesome rubiness:

@ryan_fact = ryan_facts.sample

Check it out! http://rubyfiddle.com/riddles/3b682

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is awesome! Thank you for pointing that out.

On Jan 14, 2013, at 10:23 PM, Jesse Wolgamott [email protected] wrote:

In theweb.rb:

@@ -16,3 +16,12 @@
@the_number = rand(number_as_string)
erb :number
end
+
+post '/about' do

  • ryan_facts = ['Chuck Norris wears a Ryan Moser jersey',
  •                                        'Ryan is likely to have a squid on his head',
    
  •                                        'Ryan likes to do math for fun and profit', 
    
  •                                        'The creature Ryan most resembles is a box turtle']
    
  • @ryan_fact = ryan_facts[rand( ryan_facts.length )]
    Check out this awesome rubiness:

@ryan_fact = ryan_facts.sample
Check it out! http://rubyfiddle.com/riddles/3b682


Reply to this email directly or view it on GitHub.

erb :about
end
5 changes: 5 additions & 0 deletions views/about.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h1>Random Fact About Ryan:</h1>
<h2><%= @ryan_fact %></h2>
<form method="POST" action="/about">
<input type="submit" class="btn btn-large btn-primary" value="View Another Ryan Fact"/>
</form>
3 changes: 3 additions & 0 deletions views/dashboard.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
<input type="text" id="number" name="number"/>
<input type="submit" class="btn btn-large btn-primary" value="View Number"/>
</form>
<form method="POST" action="/about">
<input type="submit" class="btn btn-large btn-primary" value="View Ryan Fact Instead"/>
</form>
4 changes: 2 additions & 2 deletions views/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
<a class="brand" href="/">Randomizer</a>
<div class="nav-collapse">
<ul class="nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li class="active"><a href="/">Home</a></li>
<li><a href="#about">About</a> </li>
<li><a href="#contact">Contact</a></li>
</ul>
</div><!--/.nav-collapse -->
Expand Down
2 changes: 1 addition & 1 deletion views/number.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<h1>OH HAI THERE</h1>
<h2>The number is <%= @the_number %>
<h2>The number is <%= @the_number %>