user = User.new
user.first_name = "Ben"
user[:first_name] = "Ben"
user.read_attribute(:first_name)
# => "Ben"
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 User < ActiveRecord::Base | |
| has_many :comments | |
| accepts_nested_attributes_for :comments | |
| end | |
| class Comment < ActiveRecord::Base | |
| belongs_to :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
| grep '50.31.164.139\|50.112.95.211\|54.247.188.179\|54.248.250.232\|54.251.34.67\|184.73.237.85\|50.18.57.7\|54.214.255.205\|54.228.244.177\|54.232.123.139\|54.241.22.142\|54.248.225.67\|54.251.109.246\|54.252.114.169\|54.252.114.170\|177.71.245.207\|200' log/production.log |
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 ContextMatters.CompositeRouter extends Backbone.Router | |
| constructor: -> | |
| @route("*path", "extractComponents") | |
| super | |
| extractComponents: (path) -> | |
| @changes ||= {} | |
| for namespace, payload of @_decode(path) | |
| unless _.isEqual(@changes[namespace], payload) |
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
| # in config/initializers/navigatrix.rb | |
| Navigatrix.register_item_renderer(:my_item) do | |
| def link | |
| link_to(name, path, class: "my-class") | |
| end | |
| def unlinked_content | |
| content_tag(:span, name) | |
| 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
| Dir[File.dirname(__FILE__) + '/support/*.rb'].each {|file| require file } |
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
| describe UserSearch do | |
| describe "#results" do | |
| let(:relation) { MockActiveRelation.new(:name_matching, :email_matching) } | |
| def results(options = {}) | |
| described_class.new(options).results | |
| end | |
| before { User.stub(scoped: relation) } |
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 MockActiveRelation < Hash | |
| attr_reader :mocked_scopes | |
| def initialize(*mocked_scopes) | |
| @mocked_scopes = mocked_scopes | |
| super() | |
| end | |
| def scoped? | |
| any? |
NewerOlder