Skip to content

Instantly share code, notes, and snippets.

ActionView::TemplateError:
ActionView::TemplateError (undefined method `item' for #<Sale:70341641267180 @id=1063696>) on line #68 of app/views/emails/folders/items_notification.text.html.erb:
65: <% case key.to_s
66: when "Sale", "Rental" -%>
67: <%=
68: changes = @entries[key].collect {|entry| entry.item.interesting_changes(@membership.last_notified_at)}.flatten(1).group_by {|change| [change[0], change[1]]}
69: changes.collect {|key, values| "#{FormattingHelper.number values.size} #{key[1].downcase}" }.join("<br />")
70: %>
71: <% when "Building" -%>
"(users.invalid_email is null\n and users.email_updates = 1\n and users.email_weekly_updates != 1\n and users.email_hourly_updates != 1\n and users.email not in (select email from email_blacklist))"
# this works but gives a ReadOnlyRecord error
FolderMember.chunky_find(:conditions => where, :joins => "JOIN users ON users.id = user_id") do |member|
puts member.id
member.frequency = "daily"
member.save
end
# this give an unknown column 'users.invalid_email' error
def self.send_all_hourly_notifications
sql_condition = <<eos
folders.discarded = 0
and users.email_updates = 1
and users.email not in (select email from email_blacklist)
and users.invalid_email != 1
and folder_members.frequency = 'hourly'
and folder_members.email_updates = 1
and folder_members.discarded = 0
eos
@stevenabrooks
stevenabrooks / sign_in.rb
Created June 30, 2014 20:40
I added the params[:origin] to the email_preferences if there was no user, let me know what you think
def sign_in
params[:return_to] ||= "back"
save_return_point
if request.post? and perform_login and params[:origin] != 'email_preferences'
#report_from_server :category => 'login', # User logged in
# :action => 'success',
# :label => "user_id=[#{current_user.id}]"
redirect_to_return_point
elsif request.post? and perform_login and params[:origin] == 'email_preferences'
@stevenabrooks
stevenabrooks / Profile Content
Created June 4, 2013 00:37
Profile Content Version 1.0
Steven Brooks
Github: stevenabrooks
Blog Url: stevenabrooks.github.io
"Steven is a beast"
Profile Picture: http://grfx.cstv.com/photos/schools/wake/sports/m-basebl/auto_action/6042660.jpeg
Treehouse: teamtreehouse.com/stevenabrooks
CoderWall: coderwall.com/stevenbrooks
CodeSchool: codeschool.com/stevenabrooks
Favorite Websites: twitter.com, facebook.com, t-nation.com, yahoo.com
Previous Work Experience:
<ol>
<li>Open the jar of jelly</li>
<li>Open the har of peanut butter</li>
<li>Take the loaf of bread out of the wrapping</li>
<li>Take one piece of bread from the loaf of bread and place it on the plate</li>
<li>With your left hand hold the piece of bread on the plate</li>
<li>With your right hand hold the knife</li>
<li>With the knife in your right hand, dip the knife into the open jar of peanut butter</li>
<li>Collect peanut butter with the knife in the open peanut butter jar</li>
<li>Spread the peanut butter that is currently on the knife onto the piece of bread located on the plate</li>
CREATE TABLE projects (
id int,
title text,
category text,
funding_goal int,
start_date text,
end_date text
);
CREATE TABLE users (
# quiz.rb
# Write a program that tells you the following:
#
# Hours in a year. How many hours are in a year? - 6pts
# Minutes in a decade. How many minutes are in a decade? - 6pts
# Your age in seconds. How many seconds old are you? - 6pts
#
# Define at least the following methods to accomplish these tasks:
#

Write an expression that returns true by using ==

1 == 1

Write an expression that returns false using ==

1 == 2

Write an expression that returns true using != Write an expression that returns false using !=

2 != 1 1 != 1

def fizzbuzz ()
number = 1
group_fizz = []
group_buzz = []
group_fizzbuzz = []
while number <= 50
case
when number % 3 == 0
puts "fizz"
group_fizz.push(number)