Skip to content

Instantly share code, notes, and snippets.

View BenEddy's full-sized avatar
💭
🍂

Ben Eddy BenEddy

💭
🍂
  • Seattle
View GitHub Profile
1. write_attribute is private, but read_attribute, []= and [] are public.
user = User.new

user.first_name = "Ben"
user[:first_name] = "Ben"

user.read_attribute(:first_name)
# => "Ben"
class User < ActiveRecord::Base
has_many :comments
accepts_nested_attributes_for :comments
end
class Comment < ActiveRecord::Base
belongs_to :user
end
@BenEddy
BenEddy / angular-bootstrap-nav.html
Created February 18, 2016 01:06 — forked from fpv83/angular-bootstrap-nav.html
angular navbar directive for twitter bootstrap with the aid of bootstrap.ui
<!DOCTYPE html>
<html data-ng-app="webapp">
<head>
<title>angular nav</title>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
<style>
body{
padding-top: 70px;
}