<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Rails Forum - Ruby on Rails Help and Discussion Forum - What breaks find_by?]]></title>
		<link>http://railsforum.com/viewtopic.php?id=45923</link>
		<description><![CDATA[The most recent posts in What breaks find_by?.]]></description>
		<lastBuildDate>Tue, 06 Sep 2011 22:06:44 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: What breaks find_by?]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=144646#p144646</link>
			<description><![CDATA[<p>case is important for Rails.<br />You have to remember that it&#039;s *nix (linux, unix)/C++ gurus that wrote ruby.<br />my_variable =&nbsp; SomeModel.find(1)<br />My_variable.something WILL give you an error as My_variable is NOT the same as my_variable</p><p>convention sais variables are all lower case separated by _ between words, with class names being camel cased (initial letters of each word being in capitals with no _to separate words.</p><p>Glad you found the problem and the next time you find yourself fighting with Rails consider whether or not you are following convention - Probably the best advice you will ever get regarding RoR.</p>]]></description>
			<author><![CDATA[dummy@example.com (jamesw)]]></author>
			<pubDate>Tue, 06 Sep 2011 22:06:44 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=144646#p144646</guid>
		</item>
		<item>
			<title><![CDATA[Re: What breaks find_by?]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=144642#p144642</link>
			<description><![CDATA[<p>I found out what appears to be the answer.&nbsp; After bracketing &quot;Tc_employee.find_by_loginid(loginid)&quot; with enough&nbsp; logger.debug statements to fill a bucket, and seeing a log file that seems to be locating the correct record with &#039;find_by_&#039;, I finally realized that the &#039;case&#039; of the variable &#039;TcEmployee&#039; must be a problem, so I changed instances of &#039;TcEmployee&#039; to &#039;tcEmployee&#039; and the &#039;find_by_&#039; started working!&nbsp; I don&#039;t remember reading about a variable names &#039;case&#039; being important but apparently it is and must start with a lower case.</p><p>Thanks to everyone that read my post and considered this problem. -Fred</p>]]></description>
			<author><![CDATA[dummy@example.com (fredrated)]]></author>
			<pubDate>Tue, 06 Sep 2011 14:15:59 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=144642#p144642</guid>
		</item>
		<item>
			<title><![CDATA[Re: What breaks find_by?]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=144582#p144582</link>
			<description><![CDATA[<p>Your log file is your friend <img src="http://railsforum.com/img/smilies/smile.png" width="15" height="15" alt="smile" /><br />Have a look at the log entries for the action concerned and you will see the SQL statements used and the params passed to the action<br />If you are not sure how to read the log file then post the entries in here along wiht the controller code</p>]]></description>
			<author><![CDATA[dummy@example.com (jamesw)]]></author>
			<pubDate>Sat, 03 Sep 2011 12:17:39 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=144582#p144582</guid>
		</item>
		<item>
			<title><![CDATA[Re: What breaks find_by?]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=144568#p144568</link>
			<description><![CDATA[<p>if TcEmployee.find_by_loginid(loginid)</p><p>it doesn&#039;t make any difference AFAIK but the rails way is more like.</p><p>Tc_employee.find_by_login_id(login_id)</p><p>Using the underscore between every natural word helps reduce the chance of using a reserved word and makes your code more readable.</p>]]></description>
			<author><![CDATA[dummy@example.com (markhorrocks)]]></author>
			<pubDate>Sat, 03 Sep 2011 05:05:24 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=144568#p144568</guid>
		</item>
		<item>
			<title><![CDATA[What breaks find_by?]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=144414#p144414</link>
			<description><![CDATA[<p>I am using agile web development with rails and am trying to implement the user authentication code.</p><p>Code (table and column names are mine):<br />if TcEmployee == find_by_loginid(loginid)<br />&nbsp; if TcEmployee.hashed_password == encrypt_password........<br />............</p><p>TcEmployee == find_by_loginid(loginid) never finds the employee record even though I know what the correct login id is and verified it with psql, a postgreSQL utility; as well as inserted logger.debug statements into the code which verified the values passed to the routine are what I think they are.</p><p>Originally I used &#039;login&#039; as the column name but in despiration changed it to loginid in case &#039;login&#039; is a reserved word.</p><p>the loginid and password are both &#039;again&#039; (you can tell I tried this a lot!) so there are no special characters that might break a search.</p><p>So what can break find_by_ and keep it from successfully locating a record?</p><p>Thanks for any help.&nbsp; -Fred</p>]]></description>
			<author><![CDATA[dummy@example.com (fredrated)]]></author>
			<pubDate>Thu, 01 Sep 2011 20:46:37 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=144414#p144414</guid>
		</item>
	</channel>
</rss>
