- build-essential
- libxml2
- libxml2-dev (for nokogiri)
- libreadline6
class User | |
has_many :products | |
def root? | |
id == 1 | |
end | |
def products_with_root | |
if root? | |
Product # Better way? |
conds = {:name => params[:name], :cas_number => params[:cas_number]}.reject {|k,v| v.nil? } | |
conds = conds.inject([[]]) {|h,(k,v)| h.first << "#{k} LIKE ?"; h << "%#{v}%"; h } | |
conds[0] = conds[0].join(' AND ') | |
ingredients = Ingredient.find(:all, :conditions => conds) |
# Rails Monkey Patch for fields_for with nested attributes. | |
# Allows an array to be supplied to a nested fields_for call instead | |
# of just a single object. | |
module ActionView | |
module Helpers | |
class FormBuilder | |
def fields_for_with_nested_attributes(association_name, args, block) | |
name = "#{object_name}[#{association_name}_attributes]" | |
obj_arg = args.first |
diff --git a/lib/ruport/acts_as_reportable.rb b/lib/ruport/acts_as_reportable.rb | |
index cdcafe9..30db614 100644 | |
--- a/lib/ruport/acts_as_reportable.rb | |
+++ b/lib/ruport/acts_as_reportable.rb | |
@@ -344,13 +344,8 @@ module Ruport | |
new_columns = [] | |
associations.each do |association| | |
- if include_has_options | |
- assoc_options = includes[association].merge({ |
# Given an articles table with a title column | |
class Article < ActiveRecord::Base | |
column_defaults["title"] = "Blank" | |
end | |
assert_equals Article.new.title, "Blank" |
Dear Andrew, | |
Thank you for your enquiry. | |
Sport England still maintain the Active Places database , however the | |
website has not had any money spent on it for a number of years and is | |
being superseded by Spogo https://spogo.co.uk/ . We are working with | |
the FIA on the development of this with an initial one year pilot. |
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
for (var i = 0; i < 3; i++) { |
44) User previous_visit_at first time another call right after still has no value | |
Failure/Error: let(:user) { Fabricate(:user) } | |
NoMethodError: | |
undefined method `first' for nil:NilClass | |
# ./lib/pretty_text.rb:122:in `block in markdown' | |
# <internal:prelude>:10:in `synchronize' | |
# ./lib/pretty_text.rb:119:in `markdown' | |
# ./lib/pretty_text.rb:175:in `cook' | |
# ./app/models/user.rb:424:in `cook' | |
# /home/andrew/.rbenv/versions/1.9.3-p362/lib/ruby/gems/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:429:in `_run__4302418198468556500__save__3765986560144774874__callbacks' |
class ApplicationController < ActionController::Base | |
# Creates an accessor which is exposed to the view | |
def self.view_accessor(*names) | |
attr_accessor *names | |
helper_method *names | |
end | |
end |