Skip to content

Instantly share code, notes, and snippets.

View bhuga's full-sized avatar

Ben Lavender bhuga

View GitHub Profile
@bhuga
bhuga / hybrid_authenticatable.rb
Created November 9, 2012 22:23 — forked from spullen/devise_create_user.rb
HybridAuthenticatable 2
class DeviseCreateUsers < ActiveRecord::Migration
def change
create_table(:users) do |t|
## Database authenticatable
t.string :username, :null => false, :default => ""
t.string :email, :null => false, :default => ""
t.string :encrypted_password, :null => false, :default => ""
## Recoverable
t.string :reset_password_token
@bhuga
bhuga / attribute_filter.rb
Created March 4, 2012 19:55 — forked from dpickett/attribute_filter.rb
attribute filter concept for mass assignment
class User < ActiveRecord::Base
protection_strategy :whitelist do
only :first_name, :last_name, :login, :password, :password_confirmation
end
protection_strategy :blacklist do
except :encrypted_password
end
end
u = User.new({protected_attribute: "blah", first_name: "John"}, filter: :whitelist)
require 'rubygems'
require 'ruby-debug'
require 'spira'
require 'rdf/rdfxml'
require 'sparql/client'
class Actor
include Spira::Resource