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 start | |
| API.api_public_key | |
| puts "Welcome to the News CLI!" | |
| menu | |
| @input = "query" | |
| while @input != "exit" && @input != "quit" && @input != "q" | |
| Article.clear | |
| article_search | |
| article_navigator |
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 article_search | |
| @input = gets.chomp | |
| Article.search(@input) unless @input == "exit" | |
| Article.all.each.with_index(1) do |art, index| | |
| puts "#{index}. #{art.title}" | |
| 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
| class User < ActiveRecord::Base | |
| has_secure_password | |
| has_many :books | |
| has_many :book_reports | |
| validates :username, presence: true, uniqueness: true | |
| 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
| require 'pry' | |
| class AuthenticationsController < ApplicationController | |
| get '/signup' do | |
| @user = User.new | |
| already_authenticated | |
| erb :'./authentication/signup' | |
| end | |
| post "/signup" do | |
| # Create a new ActiveRecord object using params submitted by Sinatra |
OlderNewer