This file contains 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 GeneralPurposeFormBuilder < ActionView::Helpers::FormBuilder | |
%w[text_field text_area collection_select].each do |method_name| | |
define_method(method_name) do |field_name, *args| | |
@template.content_tag(:div, field_label(field_name, *args) + | |
"<br />" + super + field_hint(field_name, *args), | |
:id => field_container_name(field_name), | |
:class => "form_field") | |
end | |
end | |
This file contains 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 custom version of the authenticate method allows the user to use login or email as unique keys. | |
# Please note that if using this method it's highly recommended that you make the email property, of the user model, a required one. | |
# Also consider adding a unique index to the email field. For that create a migration with: add_index :users, :email, :unique => true | |
# It's equally advisable to remove the nullable option from the email field. | |
def self.authenticate(login, password) | |
return nil if login.blank? || password.blank? | |
u = find :first, :conditions => ['(email = ? OR login = ?) and activated_at IS NOT NULL', login, login] # need to get the salt | |
u && u.authenticated?(password) ? u : nil | |
end |
This file contains 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
Feature: Manage love lines | |
In order to manage the love lines of the Love Coach | |
As a registered user | |
I want to be able to create, edit and remove love lines | |
Background: | |
Given I have at least one skin color | |
And I have at least one hair color | |
And I have at least one eye color | |
And I have at least one line type |
This file contains 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
Given /I have at least one (.+)/ do |object_type| | |
case object_type | |
when "skin color" | |
Factory(:skin_color) | |
when "hair color" | |
Factory(:hair_color) | |
when "eye color" | |
Factory(:eye_color) | |
when "line type" | |
Factory(:love_line_type) |
This file contains 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
[71, 80] in /Users/dba/work/gnomeslab.com/products/playergadget/site/vendor/plugins/authlogic_openid/lib/authlogic_openid/acts_as_authentic.rb | |
71 return false if perform_validation && authenticate_with_openid? && !authenticate_with_openid | |
72 return false if new_record? && (!openid_complete? && @openid_error.nil?) | |
73 | |
74 result = super | |
75 debugger | |
=> 76 yield(result) unless block.nil? | |
77 result | |
78 end | |
79 |
This file contains 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 'builder' | |
class LogEntry | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
#TODO put the two methods at include Mongoid::Serializers::Xml (or something alike) | |
# Fields | |
field :app_key, :type => String | |
field :level, :type => String, :default => 'INFO' |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<LogEntry> | |
<internal_mongo_document_id>4bbc50ce9ebea401a3000006</internal_mongo_document_id> | |
<internal_mongo_document_type>LogEntry</internal_mongo_document_type> | |
<created_at type="Time">2010-04-07 10:30:54 +0100</created_at> | |
<updated_at type="Time">2010-04-08 00:08:09 +0100</updated_at> | |
<app_key type="String">oi</app_key> | |
<level type="String">INFO</level> | |
<event_id type="String"></event_id> |
This file contains 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 'active_record/transitions.rb' | |
class Forum < ActiveRecord::Base | |
include ActiveRecord::Transitions | |
acts_as_nested_set | |
# Associations | |
has_many :posts | |
# Validations |
This file contains 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
(rdb:4) pp Rails.configuration | |
#<Rails::Application::Configuration:0x00000100920e90 | |
@allow_concurrency=false, | |
@cache_classes=false, | |
@cache_store= | |
[:file_store, | |
"/Users/dba/work/gnomeslab.com/programming/oauth2-ruby-server-rails-example/tmp/cache/"], | |
@consider_all_requests_local=true, | |
@dependency_loading=true, | |
@encoding="utf-8", |
This file contains 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
module ActiveRecordAttributesEquality | |
def self.included(klass) | |
klass.class_eval do | |
def ==(other) | |
return false unless other.is_a? self.class | |
if self.new_record? && other.new_record? | |
self.attributes == other.attributes | |
else |
OlderNewer