On Github benstevenson / smackdown
Ben Stevenson & Simon Timms/ @bennett_stevens @stimms
The "Monster" of Managed Hosting
The obvious and most popular example. Uses AWS and at some point we've (pretty sure) all used Heroku in some capacity.> Forge:Projects bennett$ heroku login
> Enter your Heroku credentials.
> Email: the.benstevenson@gmail.com
> Password (typing will be hidden): H4Ckz0r5
> Authentication successful.
> Forge:Projects bennett$ heroku create windnoes
> Forge:Projects bennett$ git push heroku master
user = User.new(name:"Jane")
user.save!
User.where(name:"Jane").first
Simple, straight-forward, does it's job.
Model classes represent tables and instances are rows, 1:1.User(model) = users(table name)
User::Role(model) = user_roles(table name)
String inflections control how and rails g model user name:string
rails g model family name:string
ActiveRecord::Schema.define(version: 20131120045647) do
create_table "families", force: true do |t|
t.string "name"
end
create_table "users", force: true do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
end
end
rails g migration AddEmailAndFamilyToUsers email:string family:references
# db/migrate/20131120045647_add_email_and_family_to_users.rb
class AddEmailAndFamilyToUsers < ActiveRecord::Migration
def change
add_column :users, :email, :string
add_reference :users, :family, index: true
end
end
rake db:migrate db:test:prepare
ActiveRecord::Schema.define(version: 20131120045647) do
create_table "families", force: true do |t|
t.string "name"
end
create_table "users", force: true do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
t.string "email"
t.integer "family_id"
end
add_index "users", ["family_id"], name: "index_users_on_family_id"
end
users = Arel::Table.new(:users)
query = users.where(users[:name].eq("Jane"))
query.to_sql
"SELECT FROM "users" WHERE "users"."name" = 'Jane'"
Just like LINQ, without the GUI
So there's this one little fact... MRI doesn't do multi-threading.
All boils down to the same CLR
Linux = Cheaper
Every hosting service that I know of (exp. of AppHarbor) support Linux VM's, Linux is inherantly cheaper than Windows to build and maintain. On Azure it is ~66% the cost to host a Linux VM of decent performance.1 hour to port a medium sized application over while learning.
Huge performance increases without signifigant change to code-base.
Specs passing. The JVM is the biggest competitor to the CLR, and it can be used as a long-term evolution plan in Rails.
<div class="field">
<%= f.label :name %><br>
<%= f.text_field :name %>
</div>
@Html.ValidationSummary(true)
<div class="form-group">
@Html.LabelFor(m => m.UserName, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.UserName, new { @class = "form-control" })
@Html.ValidationMessageFor(m => m.UserName)
</div>
</div>
<%= f.semantic_errors %>
<%= f.inputs do %>
<%= f.input :username %>
<% end %>
gem 'formtastic-bootstrap'
# config/initializers/formtastic.rb
Formtastic::Helpers::FormHelper.builder = FormtasticBootstrap::FormBuilder
# app/assets/stylesheets/application.css
*= require formtastic-bootstrap
gem 'formtastic-zurb-foundation'
rails generate simple_form:install --bootstrap
rails generate simple_form:install --foundation
gem 'topcoat-rails' # app/stylesheets/application.css *= require topcoat/desktop-dark *= require topcoat/desktop-light *= require topcoat/mobile-dark *= require topcoat/mobile-light