<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>e168f08 - Latest Comments in Assignment 3: Milestone II</title><link>http://e168f08.disqus.com/</link><description></description><atom:link href="https://e168f08.disqus.com/assignment_3_milestone_ii/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 18 Nov 2008 19:20:35 -0000</lastBuildDate><item><title>Re: Assignment 3: Milestone II</title><link>http://e168f08.plugh.org/assignments/assignment-3-milestone-ii/#comment-3887216</link><description>&lt;p&gt;OK. Thanks for that The combination of the bug, and my not fully understanding the flow of objects had me at a dead end. I also had not seen an example of having to use a nested hash call to access a param field from the view.  But it may be that all examples I have come across reference the 'magic' finders based on the general call to :conditions =&amp;gt; params[:user]&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">SLB</dc:creator><pubDate>Tue, 18 Nov 2008 19:20:35 -0000</pubDate></item><item><title>Re: Assignment 3: Milestone II</title><link>http://e168f08.plugh.org/assignments/assignment-3-milestone-ii/#comment-3855508</link><description>&lt;p&gt;In the console. This is prefatory work that you will find useful when moving to the implementation of Milestone III.&lt;/p&gt;&lt;p&gt;The "finds" this semester are quite easy, and most of them will be very similar to find requests in the standard "CRUD" operations in LinkWizz, CCC, etc.&lt;/p&gt;&lt;p&gt;If you feel confident, you can just move right on to Milestone III -- you will have to use these various "finds" in the implementation, but doing them separately is just intended to be a help along the way, nothing more.&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jgn</dc:creator><pubDate>Mon, 17 Nov 2008 06:27:40 -0000</pubDate></item><item><title>Re: Assignment 3: Milestone II</title><link>http://e168f08.plugh.org/assignments/assignment-3-milestone-ii/#comment-3853769</link><description>&lt;p&gt;I sent an email to Steedman earlier, but Morris correctly summarizes what I wrote.  As discussed in class, params is a 'hash-like' object, which means that for all intents and purposes you can treat it like a hash.  It is always going to have string-like data when it is passed to a controller from a view, and the keys in the params hash will be dependent upon how you construct your forms.  If you are building a form around a model, you will commonly see HTML that looks like:&lt;br&gt;&amp;lt;input type="text" name="model[attribute]"&amp;gt;&lt;/p&gt;&lt;p&gt;and this is converted to a key in the params hash that looks like params[model][attribute].  The hashes can nest even deeper -- it depends on how you construct your form.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Keith</dc:creator><pubDate>Mon, 17 Nov 2008 00:57:52 -0000</pubDate></item><item><title>Re: Assignment 3: Milestone II</title><link>http://e168f08.plugh.org/assignments/assignment-3-milestone-ii/#comment-3852717</link><description>&lt;p&gt;I'm not sure, but I think the idea is just to write expressions that will implement each of these finds, and not put them anywhere in particular for Milestone II.  I suspect that the appropriate places to use these finders will become clear with Milestone III, which I haven't yet explored in any detail.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Morris</dc:creator><pubDate>Mon, 17 Nov 2008 00:03:32 -0000</pubDate></item><item><title>Re: Assignment 3: Milestone II</title><link>http://e168f08.plugh.org/assignments/assignment-3-milestone-ii/#comment-3852669</link><description>&lt;p&gt;I'm not John, Amy, Keith, or Harlan, but I think I can answer these, if I'm right about what you're asking about.  These questions don't seem to have anything to do with Milestone II, which is where you've posted the questions.&lt;/p&gt;&lt;p&gt;If you're asking about the Linkwizz application, which seems likely based on the symbols you're using here, this has been answered in the comments on the download page.  There's a bug in the login code, which is looking at params[:login] when it should be looking at params[:user], because the form is a form_for :user.  See section 22.4, 22.5, etc. in the AWDR textbook, and also review the lecture slides about forms.  There's also some discussion about this in the comments to Milestone III.&lt;/p&gt;&lt;p&gt;&amp;lt;% form_for :foo &amp;gt;&lt;/p&gt;&lt;p&gt;will give you a hash in params[:foo], with each key in the hash being the symbol for a field in the form.  This is the way Rails is designed, and it lets you pass the entire hash, containing all of the data entered into the form, to the 'new' method for the model class, if you've created your form in the conventional way, with each form field corresponding to an attribute of the model object.&lt;/p&gt;&lt;p&gt;I don't know where you're getting "SUGGESTED SYNTAX" that skips the model class name, but it's incorrect.&lt;br&gt;Question 2: params[:user][:login] is a string.  User.find() returns an object of class User.  Without some additional code in the User class, these two expressions can't compare as equal.&lt;/p&gt;&lt;p&gt;Note also that 'find' is cleverly defined to accept a hash for the :conditions, similar to the way 'new' takes a hash.  So if the login is the only thing in the form (as it is in the Linkwizz application), then the first version of User.find you've written in your Question 2 is equivalent to the terser&lt;/p&gt;&lt;p&gt;   User.find(:first, :conditions =&amp;gt; params[:user])&lt;/p&gt;&lt;p&gt;which seems to be more idiomatic Rails.&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Morris</dc:creator><pubDate>Sun, 16 Nov 2008 23:59:07 -0000</pubDate></item><item><title>Re: Assignment 3: Milestone II</title><link>http://e168f08.plugh.org/assignments/assignment-3-milestone-ii/#comment-3845132</link><description>&lt;p&gt;For Milestone 2, where are the finds to be written?  That is, is the idea to create specific controllers/methods (actios) which would implement the finds?  Or, should we be working in script/console figuring it out?&lt;/p&gt;&lt;p&gt;Mike&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">philadelphia</dc:creator><pubDate>Sun, 16 Nov 2008 19:36:37 -0000</pubDate></item><item><title>Re: Assignment 3: Milestone II</title><link>http://e168f08.plugh.org/assignments/assignment-3-milestone-ii/#comment-3844722</link><description>&lt;p&gt;Hi John/Amy/Keith/or Harlan,&lt;/p&gt;&lt;p&gt;Question 1) Why am I having to used nested-hash syntax in order to access the :login value from form_for?&lt;/p&gt;&lt;p&gt;      # if params[:user][:login] == User.find(:first).login #THIS WORKS. &lt;br&gt;        # if params[:login] == User.find(:first).login #THIS DOES NOT. WHY? THIS IS SUGGESTED SYNTAX.&lt;/p&gt;&lt;p&gt;Question 2) Why is the login method failing to find a valid :login value in the database. ( In script/console I can use a slightly modified syntax [replacing the params argument with the login string] to easily retrieve the user record.)&lt;/p&gt;&lt;p&gt;      if params[:user][:login] == User.find(:first, :conditions =&amp;gt; ["login= ?" , params[:user][:login]]) #NOPE &lt;br&gt;      # if params[:login] == User.find(:first, :conditions =&amp;gt; ["login= ?" , params[:login]])  #NOPE &lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Steedman</dc:creator><pubDate>Sun, 16 Nov 2008 18:46:31 -0000</pubDate></item><item><title>Re: Assignment 3: Milestone II</title><link>http://e168f08.plugh.org/assignments/assignment-3-milestone-ii/#comment-3793906</link><description>&lt;p&gt;Whew! You had me worried that my dyslexia / early-onset alzheimer's was kicking in.&lt;br&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jgn</dc:creator><pubDate>Sat, 15 Nov 2008 16:52:30 -0000</pubDate></item><item><title>Re: Assignment 3: Milestone II</title><link>http://e168f08.plugh.org/assignments/assignment-3-milestone-ii/#comment-3793847</link><description>&lt;p&gt;I got it now.  Maybe I clicked on the first ZIP instead.&lt;/p&gt;&lt;p&gt;Thanks&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">student1</dc:creator><pubDate>Sat, 15 Nov 2008 16:44:31 -0000</pubDate></item><item><title>Re: Assignment 3: Milestone II</title><link>http://e168f08.plugh.org/assignments/assignment-3-milestone-ii/#comment-3793059</link><description>&lt;p&gt;On the downloads page, there is a line that looks like this:&lt;/p&gt;&lt;p&gt;    *  Milestone I:&lt;br&gt;      ZIP; Example solution to Milestone I (migrations and associations: ZIP&lt;/p&gt;&lt;p&gt;You want the second ZIP. I just did. In, for example, app/models/measurement.rb, you see the following:&lt;/p&gt;&lt;p&gt;class Measurement &amp;lt; ActiveRecord::Base&lt;br&gt;  has_many :units                   # 7b&lt;br&gt;  has_many :observation_kinds       # 6b&lt;br&gt;  validates_presence_of :name&lt;br&gt;  validates_uniqueness_of :name&lt;br&gt;end&lt;/p&gt;&lt;p&gt;In, for instance, db/migrate/20081025201508_create_measurements.rb you will find:&lt;/p&gt;&lt;p&gt;class CreateMeasurements &amp;lt; ActiveRecord::Migration&lt;br&gt;  def self.up&lt;br&gt;    create_table :measurements do |t|&lt;br&gt;      t.string :name&lt;br&gt;      t.timestamps&lt;br&gt;    end&lt;br&gt;  end&lt;/p&gt;&lt;p&gt;  def self.down&lt;br&gt;    drop_table :measurements&lt;br&gt;  end&lt;br&gt;end&lt;/p&gt;&lt;p&gt;I'm not sure what you're doing. If there is something that is not clear on the downloads page, let me know. &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jgn</dc:creator><pubDate>Sat, 15 Nov 2008 16:01:34 -0000</pubDate></item><item><title>Re: Assignment 3: Milestone II</title><link>http://e168f08.plugh.org/assignments/assignment-3-milestone-ii/#comment-3792880</link><description>&lt;p&gt;I just downloaded the solution for assignment3 milestone one on the download page. It is not a solution. The migrations and models are not filled in.  Could you point me to the right place to download.  The link text says that it is a sample solution, but is not.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">student1</dc:creator><pubDate>Sat, 15 Nov 2008 15:41:14 -0000</pubDate></item><item><title>Re: Assignment 3: Milestone II</title><link>http://e168f08.plugh.org/assignments/assignment-3-milestone-ii/#comment-3783682</link><description>&lt;p&gt;No need to answer this. I simply misinterpreted what was being said here. I looked at the child care app (again) and understand what needs to be done.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stu</dc:creator><pubDate>Fri, 14 Nov 2008 20:36:07 -0000</pubDate></item><item><title>Re: Assignment 3: Milestone II</title><link>http://e168f08.plugh.org/assignments/assignment-3-milestone-ii/#comment-3782759</link><description>&lt;p&gt;I've just started on Milestone II and have a question about #1. In parentheses you state "(in the code the user id will come from the session, i.e. session[:user_id])".  Are you referring to the web application code? In other words, we shouldn't or can't use session[:user_id] in the finder, therefore, must use some other means?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stu</dc:creator><pubDate>Fri, 14 Nov 2008 19:08:32 -0000</pubDate></item></channel></rss>