I hereby claim:
- I am arpitchauhan on github.
- I am arpitchauhan (https://keybase.io/arpitchauhan) on keybase.
- I have a public key whose fingerprint is 9ED4 1E1F FA8F 750C 11EE 6B15 A359 EE80 337B 31E3
To claim this, I am signing this object:
@movies = Movie.where("rating IN :ratings;" , {:ratings => params.has_key?(:ratings) ? params[:ratings].keys : @all_ratings}) | |
The error page: | |
ActiveRecord::StatementInvalid in Movies#index | |
SQLite3::SQLException: near ",": syntax error: SELECT "movies".* FROM "movies" WHERE (rating IN 'G','PG','PG-13','R','NC-17') | |
Full Trace: | |
sqlite3 (1.3.5) lib/sqlite3/database.rb:91:in `initialize' | |
sqlite3 (1.3.5) lib/sqlite3/database.rb:91:in `new' |
I hereby claim:
To claim this, I am signing this object:
source "https://rubygems.org" | |
ruby '2.5.1' | |
gem 'sinatra', '~> 2.0' |
source "https://rubygems.org" | |
ruby '2.5.1' | |
gem 'sinatra', '~> 2.0' |
# server.rb | |
require 'sinatra' |
class BasicAuth | |
class << self | |
def enable_if_possible | |
return unless on? | |
Sinatra::Application.use(Rack::Auth::Basic) do |username, password| | |
valid_credentials?(username, password) | |
end | |
end | |
require 'sinatra' | |
require_relative 'basic_auth' | |
BasicAuth.enable_if_possible |
require './server' | |
run Sinatra::Application | |
# To flush output immediately | |
$stdout.sync = true |
A concise definition from Wikipedia:
In functional programming, a monad is a design pattern that defines how functions, operations, inputs, and outputs can be used together to build generic types, with the following organization:
a. Define a data type, and how values of that data type are combined. b. Create functions that use the data type, and compose them together into operations, following the rules defined in the first step.