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
| --------------------------------- | |
| ---- searches_controller.rb ----- | |
| --------------------------------- | |
| def create | |
| # 1.) js file | |
| # 2.) click event to prevent default route to the controller from js with the url. | |
| # get value from form | |
| # ajax request to send form data |
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
| <script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script> | |
| <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> | |
| <script src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script> |
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
| ________________________________________________________________________ | |
| **** GIT HUB WITH GROUP PROJECTS **** | |
| ________________________________________________________________________ | |
| * git branch -d → Will delete the branch completely if it SUCKS. | |
| * AlWAYS pull first before you start your work. | |
| * git checkout develop → Never work on master branch. | |
| - Your MASTER branch must always work. | |
| ________________________________________________________________________ | |
| ** Beginning of Day: ** |
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
| <!-- views/picture/index.html.erb --> | |
| <% if flash[:msg] %> | |
| <%= flash[:msg] %> | |
| <% end %> | |
| <br> | |
| <%= link_to "create picture", new_picture_path(@picture) %> | |
| <br> | |
| <br> | |
| <% @pictures.each do |picture| %> | |
| <img src="<%= picture.image_url %>" alt="" width="300px"/> |
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
| ---------------------------------------------------------- | |
| Palindrome.rb | |
| ---------------------------------------------------------- | |
| # In ActiveRecord docs as 'validates_with' | |
| class ValidPalindrome < ActiveModel::Validator | |
| def validate(record) | |
| test_string = record.text | |
| unless test_string == test_string.reverse | |
| record.errors[:text] << 'This is not a Palindrome.' |
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
| 1.) Add the gem 'jasmine' to your gemfile like so: | |
| group :development, :test do | |
| gem 'launchy' | |
| gem 'capybara' | |
| gem 'pry-rails' | |
| gem 'selenium-webdriver' | |
| gem 'rspec-rails', '~> 3.0.0.beta' | |
| gem 'jasmine' | |
| # gem 'guard' | |
| # gem 'guard-rspec' |
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
| ###### seed.rb ################### | |
| ###################################### | |
| Complaint.delete_all | |
| url = "http://data.cityofnewyork.us/resource/erm2-nwe9.json" | |
| response = HTTParty.get(url) | |
| response.each do |incident| | |
| # c = Complaint.new |
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
| ------------------------------------------------------------- | |
| new.html.erb --> PARTIAL FORMS | |
| ------------------------------------------------------------- | |
| <div id="main"> | |
| <h1><em>Wish U Were Here</em></h1> | |
| <% if logged_in? %> | |
| <p>Hi, <%= current_user.name %>!<br><br> | |
| <img src=<%= current_user.image_url %> alt="User Profile Pic" /> | |
| <br> | |
| <span class="tagline">Where would YOU rather be?</span> |
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
| --------------------------------------------------------------------- | |
| user.rb | |
| --------------------------------------------------------------------- | |
| # == Schema Information | |
| # Table name: users | |
| # | |
| # id :integer not null, primary key | |
| # name :string(255) | |
| # email :string(255) | |
| # password_digest :string(255) |
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 log_before_doing() | |
| # puts "About to do stuff in a block." | |
| # yield | |
| # yield | |
| # end | |
| # log_before_doing() { puts "Doin' stuff in a block."} | |
| # def do_ten_times() | |
| # 10.times { yield } |