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
# ask the user what position | |
puts "What position of a Fibonacci sequence would you like to see the value of? (Ex: position 6 = 8)" | |
# method for returning the value of a position in a Fibonacci sequence | |
def fibo_it(num) | |
num <= 1 ? num : fibo_it(num - 2) + fibo_it(num - 1) | |
end | |
# get the user input and convert to integer | |
pos = gets.chomp.to_i |
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 Email < ActiveRecord::Base | |
validates_presence_of :first_name, :last_name, :email_address | |
validates_format_of :first_name, :last_name, :with => /^[A-Za-z0-9.&]*\z/ | |
validates_format_of :email_address, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i | |
validates_uniqueness_of :email_address | |
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
### PRODUCTS VIEW ### | |
<%= button_to 'Customize', new_studio_path, method: :get, :class => 'button [tiny small large] middle pos-10-top' %> |
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
## PRODUCTS VIEW ## | |
<%= button_to 'Customize', new_studio_path, :class => 'button [tiny small large] middle pos-10-top' %> |
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>Product Categories</h3> | |
<div class="large-4 columns"> | |
<%= render 'form' %> | |
</div> | |
<div class="large-8 columns"> | |
<table> | |
<thead> | |
<tr> | |
<th width="300">Name</th> |
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
# views/admin/product_categories/_form.html.erb | |
<%= simple_form_for(@product_category) do |f| %> | |
<%= f.error_notification %> | |
<div class="form-inputs"> | |
<%= f.input :name %> | |
</div> | |
<div class="form-actions"> |
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
#/views/products/index.html.erb | |
<div class="hide-for-small panel"> | |
<h3>Sidebar</h3> | |
<h5 class="subheader">Feature Product</h5> | |
<% Product.random do |product|%> | |
<%= image_tag(Product.image_url) %> | |
<h5><%= link_to Product.title, product %></h5> | |
<p><%= button_to 'Add to Cart', line_items_path(:product_id => product) %></p> | |
<% end %> |