Groups
Groups
Sign in
Groups
Groups
code71_on_rubyonrails
Conversations
About
Send feedback
Help
I cannot access class
1 view
Skip to first unread message
Rishan Shahrier
unread,
Jun 4, 2008, 6:58:12 AM
6/4/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to code71_on_rubyonrails
My first file:::
Person.rb
class Person
public
def initialize(name)
@name =name
puts @name
end
def index
puts "EHLOO"
end
end
o = Person.new("Rishan")
b = Person.new("anwar")
o.index
this file works fine.
But if i want to access this class from another file then it gives me
following error
uninitialized constant Person (NameError)
Second file P.rb
e=Person.new("Uipoka")
What should i do?
shams zawoad
unread,
Jun 5, 2008, 5:50:22 AM
6/5/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to code71_on_...@googlegroups.com
Rishan,
top of second file put
require '1st_file_name'
This will work.
Thanks,
Ratul
Rishan Shahrier
unread,
Jun 7, 2008, 11:39:25 AM
6/7/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to code71_on_...@googlegroups.com
thanks
it worked :)
--
Take Care
Rishan
Reply all
Reply to author
Forward
0 new messages