This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# User Model | |
class User < ActiveRecord::Base | |
has_one :account, :validate => true, :autosave => true | |
devise :database_authenticatable, :registerable, :lockable, | |
:recoverable, :rememberable, :trackable, :validatable | |
# Setup accessible (or protected) attributes for your model | |
attr_accessible :first_name, :last_name, :username, :email, :password, | |
:password_confirmation, :remember_me, :account_attributes | |
validates_presence_of :first_name, :last_name#, :username |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Need to grab hash from page here | |
// Append hash to iFrame src url | |
// Set path to the iframe file | |
var filePath = 'http://www.google.com'; | |
// Setup the iframe target | |
var iframe='<iframe id="frame" name="widget" src ="#" width="100%" height="1" marginheight="0" marginwidth="0" frameborder="no" scrolling="no"></iframe>'; | |
// Write the iframe to the page | |
document.write(iframe); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/helpers/application_helper_spec.rb | |
require 'spec_helper' | |
describe ApplicationHelper do | |
describe "#logo" do | |
it "image tag should point to logo.png" do | |
helper.logo.should =~ /logo.png/i | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#admin_routes_spec.rb | |
require "spec_helper" | |
describe "Admin Routes" do | |
describe "GET '/admin'" do | |
it "should block access if not on www" do | |
{ :get => "http://foo.example.com/admin" }.should_not be_routable | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# helpers/application_helper.rb | |
module ApplicationHelper | |
def setup_user(user) | |
user.build_account unless user.account | |
user | |
end | |
end | |
# app/models/account_owner.rb | |
class AccountOwner < ActiveRecord::Base |