[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Newbie: undefined method

tim.hennekey@gmail.com

3/8/2006 4:20:00 PM

I get "undefined method `name' for #<TSPProcess:0x38c7fc0>" when I
access the page with the template:

<% @processes.each do |asd| %>
<tr>
<td><%= render(:inline => "#{process.name}")%></td>
</tr>
<% end %>

The TSPProcess.rb is:

class TSPProcess
@name = "Nothing"
attr_reader :name
attr_writer :name
end

I tried defining name and name= and I get the same error.
The controller:

require 'TSPProcess'
class ProcessesController < ApplicationController
def index
@processes = Array.new
a = TSPProcess.new
@processes << a
end
end

Any help for a beginner?

6 Answers

tim.hennekey@gmail.com

3/8/2006 4:27:00 PM

0

The template should read:
<% @processes.each do |process| %>
<tr>
<td><%= render(:inline => "#{process.name}")%></td>
</tr>
<% end %>

Daniel Harple

3/8/2006 4:42:00 PM

0

On Mar 8, 2006, at 5:23 PM, tim.hennekey@gmail.com wrote:

> class TSPProcess
> @name = "Nothing"
> attr_reader :name
> attr_writer :name
> end

The @name could be causing some problems. If you really want a
default of "Nothing", you should move it to the #initialize method.

def initialize
@name = "Nothing"
end

Try:

class TSPProcess
attr_accessor :name
end

and in your template:

<% @processes.each do |process| %>
<tr>
<td><%= render(:inline => "#{process.name or "Nothing"}")%></td>
</tr>
<% end %>

> require 'TSPProcess'

You should ruby's convention for file-naming: require 'tsp_process'

> class ProcessesController < ApplicationController
> def index
> @processes = Array.new
> a = TSPProcess.new
> @processes << a
> end
> end

You could shorten this to:
class ProcessesController < ApplicationController
def index
@processes = [TSPProcess.new]
end
end

-- Daniel


tim.hennekey@gmail.com

3/8/2006 4:56:00 PM

0

This worked out for me, thank you.

CUNTICA

9/23/2013 5:36:00 PM

0


"spray to combat premature ejaculation"... Geez, Heinrich, is that what you use when the cocksucker ol' Goooooran Radavich blows you & you cum all over his face & then give him a big wet French kiss with lots of tongue?

"Oh, Goran.........!"

\\\y///
^
()
oIIo

"Gobble - gobble, slurtp - slurp! Gulp!''

"Oh, Goran........!

"Now give ol' Heinrich a big wet French kiss with lots of tongue!''

NEMO

9/23/2013 7:45:00 PM

0

On 9/23/2013 12:33 PM, The Peeler wrote:
> On Mon, 23 Sep 2013 12:24:33 -0700, "NEMO", wrote:

>>> Awww, and I greedy Grik fag weren't, there to try and, take possession of his cut
>>> off dork? But I can, still keep fantasizing, about it while, I am rotting
>>> away on, my skata-stained Grik couch innit! <BG>
>>
>> You, CAN anus! <GB>
>
> We two inseparable Grik fags - me and Grikboxer - can do it together innit! ;-)

You, CAN anuses innit! LO!

>> BTW I just saw, seems, looks like, it's almost, 12:30 pm and I've, only
>> been out, of this mine own house, once all day again innit! Fucking,
>> unbelievable but there it is innit! I seen, it with these, mine own
>> eyes innit! LO!
>
> INTERESTING! But why, do you keep, telling us this innit? I seem, to need to,
> justify myself all, the time innit and seem, to be under SEVEREST Grik mental
> stress, as poor psychotic Grik idiot! Has, perhaps, The Peeler been greeked again? >
> *LMAP*!!!

INTERESTING! Talking about, yourself in, the turd person innit anus!
DEFINITELY a sure sign, of psychosis innit! LO!

NEMO

9/23/2013 7:46:00 PM

0

On 9/23/2013 10:36 AM, brianlambsnose@yahoo.com wrote:

> \\\y///
> ^
> ()
>
> "Gobble - gobble, slurtp [sic] - slurp! Gulp!''

Can't even get THAT right, you illiterate jewbaited jew wog piece of
shite! LOL!