Created
November 16, 2012 21:26
-
-
Save deitrick/4091067 to your computer and use it in GitHub Desktop.
Something funky going on...
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
# I'm getting an empty result when viewing this in my application; testing on /project/2/ page | |
<% if @project.quickbits.present? %> | |
<div class="accordion"> | |
<% @project.quickbits.where(user_id: 1).each do |bit| %> | |
<h5 style="padding-left: 25px;"><%= bit.title %></h5> | |
<div> | |
<p><%= bit.content %></p> | |
</div> | |
<% end %> | |
</div> | |
<% end %> | |
#Yet this is what returns in my console | |
# 1.9.3p286 :039 > Project.find(2).quickbits.where(user_id: 1).flatten.each do |bit| | |
# 1.9.3p286 :040 > puts bit.title | |
# 1.9.3p286 :041?> end | |
# Project Load (0.7ms) SELECT "projects".* FROM "projects" WHERE "projects"."id" = $1 LIMIT 1 [["id", 2]] | |
# Quickbit Load (0.4ms) SELECT "quickbits".* FROM "quickbits" WHERE "quickbits"."project_id" = 2 AND "quickbits"."user_id" = 1 | |
# Whaaaa | |
# WTF | |
# => [#<Quickbit id: 24, project_id: 2, user_id: 1, title: "Whaaaa", content: "test", created_at: "2012-11-16 21:11:53", updated_at: "2012-11-16 21:11:53">, #<Quickbit id: 25, project_id: 2, user_id: 1, title: "WTF", content: "asdfasdfasdf", created_at: "2012-11-16 21:19:21", updated_at: "2012-11-16 21:19:21">] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment