How to Create a Ruby GemNovember 10, 2014
Here is the most modern approach to gem crafting:
bundle gem gemname cd gemname
edit your_gem.gemspec and add description, summary, required gems and optional website. Add required gems for development such as rspec, rails or minitest to the Gemfile.
rspec --init touch spec/your_gem_spec.rb
Setting up an Ubuntu 14.04 Server for RailsNovember 25, 2014
Assuming you're logged in as root add these users and login as "not root."
adduser deploy adduser [yourname] #optionally vim /etc/group # add your users to the sudo group like so: # sudo:x:27:isaac,deploy su - deploy # or your username. The important thing is that you use a user other than root.
Setting up Ruby on Rails for OSX (10.10) YosemiteMarch 20, 2015
Very little has changed since Mavericks but here's an updated tutorial.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew doctor brew update
brew install rbenv ruby-build openssl
Fixing MacVim Fullscreen in YosemiteMarch 17, 2015
Many long term users of Macvim like myself have been annoyed that fullscreen mode cuts off the first couple lines and shows a bar on the right when using OSX Yosemite. After trying out multiple forks that kind of fixed it but also introduced other problems I finally found a satisfactory fix. Just run this in the terminal to turn off yosemites fullscreen method on macvim.
$ defaults write org.vim.MacVim MMNativeFullScreen 0
Saving dynamic serialized fields with fields_for in RailsFebruary 23, 2015
Tell you model to serialize it as a struct and create a setter to build the struct on create.
# post.rb model serialize :content, OpenStruct def content=(v) self[:content] = OpenStruct.new(v) end
Then you can add any form elements you want for content.
-#form partial = f.fields_for :content, @post.content do |ff| .field = ff.label :name = ff.text_field :name .field