<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>e168f08 - Latest Comments in Protected: Downloads</title><link>http://e168f08.disqus.com/</link><description></description><language>en</language><lastBuildDate>Fri, 12 Dec 2008 19:52:03 -0000</lastBuildDate><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-4380338</link><description>I'm not sure why you would want a link to a specific entry for a book? More typical are:&lt;br&gt;&lt;br&gt;-- Let me see the book associated with this index entry:&lt;br&gt;&lt;br&gt;&amp;lt;%= link_to 'Book for this index entry',   &lt;a href="mailto:book_path(@index_entry.book" rel="nofollow"&gt;book_path(@index_entry.book&lt;/a&gt;) %&amp;gt; |&lt;br&gt;(put in views/index_entries/show.html.erb&lt;br&gt;&lt;br&gt;-- Or, let me see the index entries for this book:&lt;br&gt;&lt;br&gt;&amp;lt;%= link_to 'Index entries for this book', book_index_entries_url(@book) %&amp;gt; |&lt;br&gt;(put in views/books/show.html.erb</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">xertroyt</dc:creator><pubDate>Fri, 12 Dec 2008 19:52:03 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-4378846</link><description>John,&lt;br&gt;&lt;br&gt;I am looking at booksindex for an example of nested routes. I see where the nesting is declared in the routes file. But the path names don't seem to reflect nesting. (Though they obviously work.)&lt;br&gt;&lt;br&gt;As close as I understand, without any special configuration, the route parameter on the for index.html.erb in the index_entries view folder, would be, for example,     &amp;lt;td&amp;gt;&amp;lt;%= link_to 'Show', book_index_entry_url(@book, index_entry) %&amp;gt;&amp;lt;/td&amp;gt;. With @book providing the book ID, and index_entry providing the index_entry id.&lt;br&gt;&lt;br&gt;Is that correct?&lt;br&gt;&lt;br&gt;I know there are shortcuts to reduce the name parameter, but in order to understand it, I am trying to figure out what the actual syntax should be for route parameters.&lt;br&gt;&lt;br&gt;Is it possible to see a version with routes fully flushed out, in a non-shortcut way, just to get the flavor of the correct syntax?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">S. Bass</dc:creator><pubDate>Fri, 12 Dec 2008 18:06:49 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-4208214</link><description>Thank you for the sympathetic ear. The thing I was missing was the 1:n relation between measurements and units.&lt;br&gt;&lt;br&gt;I was using the equivalent of x[0].units.id rather than x[0].units.first.id . &lt;br&gt;&lt;br&gt;Having to explain the problem helps clarify the issues in my own head.&lt;br&gt;&lt;br&gt;I am still curious about the sql code view though.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">vaughanatworld</dc:creator><pubDate>Fri, 05 Dec 2008 14:27:10 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-4207435</link><description>You can iterate through the resutls . . .&lt;br&gt;&lt;br&gt;    x.each { |item| ... }&lt;br&gt;&lt;br&gt;Incidentally, X should not be capitalized. If you do that, it's a constant.&lt;br&gt;&lt;br&gt;As well, you probably want to put in a variable id for where you have the literal "6" -- this is a big, big "no no." Review section 17.5 of AWDR and take a look at the ? syntax for conditions.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">xertroyt</dc:creator><pubDate>Fri, 05 Dec 2008 13:47:26 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-4207168</link><description>I am running system/console in C:\aaa\rubyStuff2\e168-assignment3-milestone-3-30000&lt;br&gt;&lt;br&gt;I am having trouble writing a sql select  to get units.id given observation_kinds.id. Here is the ActiveRecord code that I am using.&lt;br&gt;&lt;br&gt;&amp;gt;&amp;gt; X = Measurement.find(:all, :conditions =&amp;gt; "observation_kinds.id = 6", :include =&amp;gt; [:observation_kinds, :units])&lt;br&gt;&lt;br&gt;X appears to be an Array but I am having difficulty navigating X. What little bit that I can see does not include units.&lt;br&gt;Second, I would really like to see the sql code used to get whatever is in X.&lt;br&gt;Setup.rb from a previous assignment (I assume for use without Rails; just ActiveRecord with ruby) does not provide me sufficient clues to see the sql.&lt;br&gt;Given the number of hours I have spent on this, I am ready for some hints.&lt;br&gt;Thanks&lt;br&gt;Brian</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">vaughanatworld</dc:creator><pubDate>Fri, 05 Dec 2008 13:33:07 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3774760</link><description>Thanks.&lt;br&gt;&lt;br&gt;I now see where this bug crept in.&lt;br&gt;&lt;br&gt;In the original version (last year) of LinkWizz, the e-mail address was always used (rather than a username / login name). Somewhere in the refactoring I switched the :conditions =&amp;gt; specification, and, obviously, did it wrongly.&lt;br&gt;&lt;br&gt;When I get home I will check to make sure that this issue hasn't propagated elsewhere (e.g., to CCC).&lt;br&gt;&lt;br&gt;I actually dumbed down the user controller in LinkWizz and CCC in order to make the switch (will I will be showing) to acts_as_authenticated more dramatic. But as you can see, I dumbed it down too much.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">xertroyt</dc:creator><pubDate>Fri, 14 Nov 2008 13:30:59 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3774396</link><description>Yup... that works...&lt;br&gt;&lt;br&gt;Mike</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">philadelphia</dc:creator><pubDate>Fri, 14 Nov 2008 13:07:39 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3774111</link><description>So the fix is to change the call to User.find to&lt;br&gt;&lt;br&gt;User.find(:first, :conditions =&amp;gt; params[:user])&lt;br&gt;&lt;br&gt;where params[:user] is a hash, containing the key :login&lt;br&gt;&lt;br&gt;since there's no params[:login], the existing call&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;User.find(:first, :conditions =&amp;gt; params[:login])&lt;br&gt;&lt;br&gt;calls User.find with no conditions, and always returns the first row in the users table.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Morris</dc:creator><pubDate>Fri, 14 Nov 2008 12:51:03 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3773902</link><description>I think I've found the problem.  I added some debugging code to UsersController#login, just after the call to User.find:&lt;br&gt;&lt;br&gt;if @user&lt;br&gt;  puts "found user #{params.login}"&lt;br&gt;  puts "User's name is #{@user.login}"&lt;br&gt;end&lt;br&gt;&lt;br&gt;to see what this code is getting from the database.&lt;br&gt;Logging in again, I see, amidst lots of other output,&lt;br&gt;&lt;br&gt;found user&lt;br&gt;User's name is herbert&lt;br&gt;&lt;br&gt;Note that there's nothing after "user" in "found user".  For some reason, params[:login] is blank.&lt;br&gt;Looking at view/users/login.html.erb, we see&lt;br&gt;      &amp;lt;%= form.text_field :login&lt;br&gt;so there ought to be a :login entry in the hash.&lt;br&gt;&lt;br&gt;but viewing the source of the HTML as seen by the browser, we see the corresponding HTML form field has the attributes&lt;br&gt;&lt;br&gt;id="user_login" name="user[login]" because this is a "&amp;lt;% form_for :user"</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Morris</dc:creator><pubDate>Fri, 14 Nov 2008 12:38:43 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3773711</link><description>But this is happening on my own machine, with no previous session, so session handling seems unlikely.&lt;br&gt;Digging around, I see that there's only one row in the "users" table.  Using script/dbconsole, I update that row so that the login column has the value 'herbert'.  Closing my browser and restarting it, I attempt to login with the name "Morris", and the system tells me I'm "Logged in as herbert".  [I am not herbert].&lt;br&gt;&lt;br&gt;I suspect there's something wrong with your find, which is finding the first row in the database table, regardless of the string entered in the form.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Morris</dc:creator><pubDate>Fri, 14 Nov 2008 12:28:25 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3773060</link><description>See the discussion with "philadelphia" below -- the problem seems to be that the session isn't getting cleared out.&lt;br&gt;&lt;br&gt;I will provide an explanation or a fix tonight: It's possible that something subtle has changed between Rails 1.x and 2.1 regarding session handling.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">xertroyt</dc:creator><pubDate>Fri, 14 Nov 2008 11:49:08 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3772995</link><description>Oops.  I meant to type "john" (no uppercase J)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Morris</dc:creator><pubDate>Fri, 14 Nov 2008 11:45:32 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3772986</link><description>I haven't looked at the code yet, but I did notice, with just a little playing with the application, that whatever name I type in to the login field, the next page always tells me I'm logged in as "John"</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Morris</dc:creator><pubDate>Fri, 14 Nov 2008 11:44:56 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3772720</link><description>Thanks.  Also, I see now that regardless of what I place into the login field, the code below always evaluates to john...  &lt;br&gt;&lt;br&gt;@user = User.find(:first, :conditions =&amp;gt; params[:login])&lt;br&gt;flash[:notice] = @user.login # outputs 'john'</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">philadelphia</dc:creator><pubDate>Fri, 14 Nov 2008 11:30:52 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3772310</link><description>I think you've found a bug. This bit from what you say:&lt;br&gt;&lt;br&gt;click on logout&lt;br&gt;flash[:notfiy] places 'Logged out' above the text entry box (and the label of Login or Register)&lt;br&gt;&lt;br&gt;This time I type in 'test'&lt;br&gt;logs in... indicates logged in as john in upper right menu bar&lt;br&gt;shows default google news bookmark&lt;br&gt;&lt;br&gt;-----&lt;br&gt;&lt;br&gt;Notice that UserController#logout says: reset_session - that is supposed to kill the session, so that, e.g., session[:login] should not have a value.&lt;br&gt;&lt;br&gt;Let me get back to you on that, with an explanation or a fix.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">xertroyt</dc:creator><pubDate>Fri, 14 Nov 2008 11:22:55 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3772202</link><description>OK... here's what I am doing&lt;br&gt;&lt;br&gt;did the rake db:migrate&lt;br&gt;running the ruby script/server&lt;br&gt;browsing to &lt;a href="http://localhost:3000/" rel="nofollow"&gt;http://localhost:3000/&lt;/a&gt; using Firefox v 2.0.0.18&lt;br&gt;&lt;br&gt;Get the login page with Login or Register above the text box&lt;br&gt;type John in the text box&lt;br&gt;press enter&lt;br&gt;&lt;br&gt;logs in... indicates logged in as john in upper right menu bar&lt;br&gt;shows default google news bookmark&lt;br&gt;&lt;br&gt;click on logout&lt;br&gt;flash[:notfiy] places 'Logged out' above the text entry box (and the label of Login or Register)&lt;br&gt;&lt;br&gt;This time I type in 'test'&lt;br&gt;logs in... indicates logged in as john in upper right menu bar&lt;br&gt;shows default google news bookmark&lt;br&gt;&lt;br&gt;I would have expected two things based upon a read of the code:&lt;br&gt;&lt;br&gt;1.) a flash[:notice] showing 'User created.'&lt;br&gt;2.) a logged in as test in the upper right corner of the menu bar&lt;br&gt;&lt;br&gt;When I try to debug it, I see that !@user always evaluates to false.&lt;br&gt;So, I throw a flash[:notice] = @user in after the find, and I see that @user is being set to '#' so it is not nil&lt;br&gt;&lt;br&gt;Don't know why I see john as the user...  confusing me&lt;br&gt;&lt;br&gt;Mike</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">philadelphia</dc:creator><pubDate>Fri, 14 Nov 2008 11:16:53 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3772170</link><description>If you type in "foobar" as the login name, User.find(:first, :conditions =&amp;gt; params[:login]) should return nil, that is, nil would be assigned to @user&lt;br&gt;&lt;br&gt;So then we effectively say . . .&lt;br&gt;&lt;br&gt;   if !nil&lt;br&gt;&lt;br&gt;(!nil evaluates to true)&lt;br&gt;&lt;br&gt;i.e., if there is no user by that name, create one.&lt;br&gt;&lt;br&gt;OK?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">xertroyt</dc:creator><pubDate>Fri, 14 Nov 2008 11:14:29 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3772002</link><description>Mistated the above a bit.  Meant to say it looks as if @user is always true, no matter what login information is typed into the login field.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">philadelphia</dc:creator><pubDate>Fri, 14 Nov 2008 11:04:41 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3771912</link><description>Mike,&lt;br&gt;&lt;br&gt;Could you provide some steps to reproduce:&lt;br&gt;&lt;br&gt;1. Start not logged-in&lt;br&gt;2. Enter John as the user&lt;br&gt;&lt;br&gt;etc.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">xertroyt</dc:creator><pubDate>Fri, 14 Nov 2008 10:59:17 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3771847</link><description>I have a question about LinkWizz... maybe I missed something in lecture.  Not sure.&lt;br&gt;&lt;br&gt;I'm going through the code and playing around with it.  When I enter a new user, it looks like the user_controller code:&lt;br&gt;&lt;br&gt; @user = User.find(:first, :conditions =&amp;gt; params[:login])&lt;br&gt;                  &lt;br&gt;      # If there wasn't a user, create one&lt;br&gt;      if !@user&lt;br&gt;        @user = User.new(params[:user])&lt;br&gt;        if @user.save&lt;br&gt;          flash[:notice] = 'User created.'&lt;br&gt;        else&lt;br&gt;          flash[:notice] = 'Couldn\'t register user.'&lt;br&gt;          # We return at this point, so that the POST will&lt;br&gt;          # complete, and views/users/login.rhtml will be&lt;br&gt;          # used, which has all of the validation info.&lt;br&gt;          return&lt;br&gt;        end&lt;br&gt;      end&lt;br&gt;&lt;br&gt;should be executed.  But I do not see any value being populated in the params[:login].  The site always logs in as 'John'.  What am I missing?&lt;br&gt;&lt;br&gt;Mike</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">philadelphia</dc:creator><pubDate>Fri, 14 Nov 2008 10:54:50 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3769110</link><description>Fixed.&lt;br&gt;&lt;br&gt;I had created that ZIP at work -- the rake "package" task uses the user's login name, and at work I'm jnorman while at home I'm jgn -- and I had just changed the version number in the file name.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">xertroyt</dc:creator><pubDate>Fri, 14 Nov 2008 07:26:06 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3766538</link><description>The link to the "cycle" app gets a 404 error.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Morris</dc:creator><pubDate>Thu, 13 Nov 2008 23:55:02 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3033202</link><description>Yes -- I removed it. I neglected to add "modified slide" to that one, and added the remark to the slide with the image.&lt;br&gt;&lt;br&gt;From slide to slide, JRuby keeps the class cached, and since I had earlier defined the class without a superclass of Person, the example wasn't running properly when I later defined it with a superclass.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">xertroyt</dc:creator><pubDate>Mon, 13 Oct 2008 22:33:54 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3032774</link><description>As of 10/12/2008 at 4:25 PM, which is the date on "lecture4.html" in the ZIP file I downloaded, slide 35 doesn't match the slide used during the lecture.&lt;br&gt;The line "class Person; end" directly above class Player is missing, and class Player is not a subclass of Person.  The not-very-usable slides being served with the video do contain the Person class.  (I've checked the HTML source in emacs to make sure that it's not the Slidy application acting up).</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Morris</dc:creator><pubDate>Mon, 13 Oct 2008 21:49:41 -0000</pubDate></item><item><title>Re: Protected: Downloads</title><link>http://e168f08.plugh.org/downloads/#comment-3012788</link><description>I just posted a fresh version of the ZIP file that has the HTML lectures -- there are a number of modified slides, and an additional slide regarding the mistake I made where I included a module and was surprised that a method in the target class wasn't overridden.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">xertroyt</dc:creator><pubDate>Sun, 12 Oct 2008 16:39:07 -0000</pubDate></item></channel></rss>