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 Hash | |
# Returns the value at the specified path. | |
# For example, [:foo, :bar, :baz] as a path would return the | |
# value at self[:foo][:bar][:baz]. If self doesn't contain one of | |
# the keys specified in path, nil is returned. | |
# | |
# This method is useful as it simplifies statements such as: | |
# value = h[:a][:b][:c][:d] if h[:a] && h[:a][:b] && h[:a][:b][:c] | |
# to | |
# value = h.value_at_path([:a, :b, :c, :d]) |
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 Object | |
# Returns the value at the specified path. | |
# For example, "foo.bar.baz" as a path would return the | |
# value at self[:foo][:bar][:baz]. If self doesn't contain one of | |
# the keys specified in path, It will return the farthest object found (will return self if it couldn't find anything). | |
# | |
# @param String keypath A path composed of keys separated with "." specifying a deep-nested path | |
# @return Object the value object | |
class Object |
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 @GroupActionMenuHandler | |
bind: -> | |
$(document).on 'click', '.group-action-menu a', this.selectMenuItem | |
selectMenuItem: (event) -> | |
id = $(e.target).data('id') | |
alert 'hello' | |
false | |
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
@memberships = current_user.memberships | |
project_ids = @memberships.collect {|m| m.project.id} | |
@events = Event.select("id, name, description, start_at, end_at, all_day, project_id").where("project_id IN ?", project_ids).to_json |
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
<select id="individual"> | |
{{range .EMPLOYEES}} | |
{{ if .Selected }} | |
<option value="{{.ID}}" selected>{{.Name}}</option> | |
{{ else }} | |
<option value="{{.ID}}">{{.Name}}</option> | |
{{ end }} | |
{{else}} | |
<option value="nil">----</option> | |
{{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
NoMethodError in ElectionsController#update | |
undefined method `each' for "#<Candidate:0x000000046fb310>":String | |
Rails.root: /home/jonblack/projects/mcet | |
Application Trace | Framework Trace | Full Trace | |
app/controllers/elections_controller.rb:50:in `block in update' | |
app/controllers/elections_controller.rb:49:in `update' |
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 Foo | |
has_many :tags | |
has_many :states | |
# q is hash: { "tags" => "ruby", "states" => "open" } | |
def self.search(q) | |
# wat do? | |
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
class User < ActiveRecord::Base | |
include Redis::Objects | |
counter :reminders_to_send | |
def purge | |
@@redis_objects = {} | |
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
class Ticket::GrouperValidator < ActiveModel::Validator | |
def validate(record) | |
record.errors.add :grouper, 'has already occurred!' if record.grouper.full? | |
record.errors.add :grouper, 'has already occurred!' if record.grouper.past? | |
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
ip_address_whitelist: | |
- 127.0.0.1 | |
- 1.2.3.4 | |
- 5.6.7.8 | |
whitelisted_pages: | |
- /assets/.* | |
- / | |
- /login |
OlderNewer