Skip to content

Instantly share code, notes, and snippets.

class Developer
def salery
5000
end
end
class Manager
def salery
8000
end
class PhotosController < ApplicationController
def show
if params.has_key? :time
@main_photo = "http://www.google.com/images/srpr/logo11w.png"
end
end
end
require 'bundler'
Bundler.setup(:default)
require 'active_record'
require 'minitest/autorun'
require 'logger'
# This connection will do for database-independent bug reports.
ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: 'test123')
ActiveRecord::Base.logger = Logger.new(STDOUT)
@senny
senny / grouped_select.erb
Created July 29, 2014 12:24
grouped select
<%= form_tag "#" do %>
<%= select_tag "name", grouped_options_for_select("Group 1" => ["value 1", "value 2"], "Group 2" => ["value 3", "value 4"]) %>
<% end %>
diff --git a/actionmailer/test/url_test.rb b/actionmailer/test/url_test.rb
index 589944f..5912e9a 100644
--- a/actionmailer/test/url_test.rb
+++ b/actionmailer/test/url_test.rb
@@ -12,6 +12,7 @@ end
class UrlTestMailer < ActionMailer::Base
default_url_options[:host] = 'www.basecamphq.com'
+ default_url_options[:protocol] = 'https'
class ProjectForm < AbstractForm
attribute :name, required: true
association :tasks, records: 3 do
attribute :name, required: true
end
end
@senny
senny / patch.diff
Last active August 29, 2015 14:01
4-1-stable backportable patch of https://github.com/rails/rails/issues/15369
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index c39240d..a8d3723 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,3 +1,10 @@
+* Keep PostgreSQL `hstore` and `json` attributes as `Hash` in `@attributes`.
+ Fixes duplication in combination with `store_accessor`.
+
+ Fixes #15369.
+
== Installing dependencies ==
Using rake 10.3.2
Using i18n 0.6.9
Using json 1.8.1
Using minitest 5.3.4
Using thread_safe 0.3.3
Using tzinfo 1.1.0
Using activesupport 4.1.0
Using builder 3.2.2
Using erubis 2.7.0
class Person
end
class Manager < Person
def say
puts "welcome"
end
end
class Manager
require 'bundler'
Bundler.setup(:default)
require 'active_record'
require 'minitest/autorun'
require 'logger'
# This connection will do for database-independent bug reports.
ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: 'test123')
ActiveRecord::Base.logger = Logger.new(STDOUT)