workflow:
$ rails g model NameOfModel
invoke active_record
create db/migrate/YYYYMMDDHHMMSS_create_name_of_models.rb
#!/usr/bin/env ruby | |
require 'open-uri' | |
require 'JSON' | |
require 'digest/sha2' | |
require 'pry' | |
require 'bigdecimal' | |
require 'bitcoin' # Because I need to cheat every now and then | |
# Usage: | |
# gem install pry json ffi ruby-bitcoin |
# Fill in multiple form fields using a table. Use it as follows: | |
# | |
# When I fill in the fields | |
# | Field 1 | Value 1 | | |
# | Field 2 | Value 2 | | |
When /^I fill in the fields$/ do |table| | |
table.rows_hash.each {|field, value| fill_in field, :with => value } | |
end |
Worked 2015-09-08 for Phoenix 1.0.1 on Dokku 0.3.25.
These instructions assume you've set up Dokku. If not, go find a tutorial for that part. My notes for setting it up on Digital Ocean.
Create a Dokku app:
class CreateProjects < ActiveRecord::Migration[5.0] | |
def change | |
create_table :projects do |t| | |
t.string :name | |
t.timestamps | |
end | |
end | |
end |
ActiveAdmin.register NutritionData do | |
menu false | |
form do |f| | |
f.inputs "Details" do | |
f.input :item_id, :as => :hidden | |
f.input :header, :input_html => {:rows => 5} | |
f.input :serving, :input_html => {:rows => 5} | |
f.input :calories | |
f.input :calories_from_fat |