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
class MyModel < ActiveRecord::Base | |
attr_accessor :foo_bar | |
def foo_bar | |
@foo_bar || [] | |
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
class MyModel < ActiveRecord::Base | |
after_initialize :setup_defaults | |
attr_accessor :foo_bar | |
def setup_defaults | |
@foo_bar ||= "my default value" | |
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
root :to => 'user#home', :constraints => lambda {|r| | |
r.env['warden'].user.class.name == 'User' | |
} | |
root :to => 'organizer#home', :constraints => lambda {|r| | |
r.env['warden'].user.class.name == 'Organizer' | |
} |
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
Class Book < ActiveRecord::Base | |
def self.by_authors(author_ids) | |
where(:author_id => author_ids).map{ |book| | |
issuer = book.issuer | |
issuer.foo = boo.foo | |
} | |
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
#instead of | |
def foo | |
end | |
def foo.bar | |
'foobar' | |
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
/* | |
* This is a manifest file that'll automatically include all the stylesheets available in this directory | |
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at | |
* the top of the compiled file, but it's generally better to create a new file per style scope. | |
*= require_self | |
*= require_tree . | |
*= require layout | |
*/ |
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
development: | |
adapter: postgresql | |
database: emotio-dev | |
pool: 5 | |
timeout: 5000 | |
# Warning: The database defined as "test" will be erased and | |
# re-generated from your development database when you run "rake". | |
# Do not set this db to the same as development or production. | |
test: |
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
require 'spec_helper' | |
describe ProfileController do | |
include Devise::TestHelpers | |
before(:each) do | |
@user = Factory.create(:user) | |
sign_in @user | |
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
filename=$(basename $0) | |
APP=${filename#thin-} | |
CONFIG="/etc/thin/$APP.yml" | |
ARGS="--daemonize --config=/etc/thin/$APP.yml" | |
RVM_ENV="ruby-1.8.7-p352@redmine" | |
source "/usr/local/rvm/environments/$RVM_ENV" | |
COMMAND="sudo -Eu $APP $(which thin)" | |
case "$1" in | |
start) |
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
require 'spec_helper' | |
describe 'Signed in' do | |
before(:each) do | |
user = Factory(:user) | |
visit new_user_session_path | |
fill_in 'Email', with: user.email | |
fill_in 'Password', with: user.password | |
click_button 'Sign in' |