Hit By a Train

  • user warning: Table 'nolan.comments' doesn't exist query: SELECT COUNT(*) FROM comments WHERE nid = 238 AND status = 0 in /home/sneakin/web/nolan.eakins.net/includes/database.mysql.inc on line 120.
  • user warning: Table 'nolan.comments' doesn't exist query: SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.picture, u.data, c.score, c.users, c.thread, c.status FROM comments c INNER JOIN users u ON c.uid = u.uid WHERE c.nid = 238 AND c.status = 0 GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, u.picture, c.homepage, u.uid, u.name, u.picture, u.data, c.score, c.users, c.thread, c.status ORDER BY c.thread DESC LIMIT 0, 50 in /home/sneakin/web/nolan.eakins.net/includes/database.mysql.inc on line 120.
|

I'm actually trying to produce something with Ruby on Rails, and I finally got hit by the train. Here's the problem that makes no sense at all. I have a view that does the following:

<%= render :partial => 'role', :collection => @roles %>

@roles is a class attribute that's an array of roles which gets iterated over. This is where things get foobarred. In the partial I get a variable called role which is good, but I want to render a text field in this partial. Rails provides me with text_field. Good again because I can just enter the following to print the role's name:

<%= text_field "role", "name" %>

But wait! text_field will only work with class attributes for some dumb reason. Yes, that means it'll call @role.name to get the name, not role.name. If I wanted @role, I would have used @role in my call to text_field.

I can not figure out why this could have been a good idea. Now I'm stuck contemplating whether I should hack up my own text_field that works logically or not.

Ad's by Google