[Nitro] nitro 0.40.0 changes?

Matt Rose mattrose at folkwolf.net
Wed Nov 15 22:10:44 EST 2006


Where is this documented?

I have to say, I'm not very impressed right now.  right now, it looks  
like all my work has to be re-written from scratch.    I've finally  
figured out how to get my app to start, and the console is great to  
work with, but I still can't get past the starting gate.

I have two classes.  Master is just a one-off table that holds some  
meta-information.  It has no relations to any other table.  But while  
I can use other models, I can't use this one.

here's the class.

class Master
   attr_accessor :title
   attr_accessor :description
   attr_accessor :user
   attr_accessor :pass
   def initialize(title,desc,user,pass)
     @title, at description, at user, at pass = title,desc,user,pass
   end
   def to_s
     @title
   end
end

class Blog
	attr_accessor :title, String
	attr_accessor :description, String
	has_many :users, User
	has_many :articles, Article
	def initialize(title,description)
	  @title, at description = title,description
	end
	def to_s
	  @title
	end
end

and here's the output.


 >> matt-roses-computer:~/ruby/start mattrose$ nitro console
INFO: Og uses the Sqlite store.
/usr/local/lib/ruby/1.8/logger.rb:525:in `initialize':Errno::ENOENT:  
No such file or directory - log/app.log
 >> Blog.all
=>
 >> Master.all
NoMethodError: undefined method `all' for Master:Class
         from (irb):2
         from :0


On 15-Nov-06, at 8:41 AM, transfire at gmail.com wrote:

>
> Matt Rose wrote:
>> I just installed the new nitro, and it absolutely broke the app I was
>> working on.
>>
>> I tried running it as is, and I got this error:
>>
>> matt-roses-computer:~/ruby/start mattrose$ nitro
>> /Users/mattrose/ruby/start/model.rb:2: undefined method
>> `prop_accessor' for Master:Class (NoMethodError)
>>          from /usr/local/lib/ruby/site_ruby/1.8/rubygems/
>> custom_require.rb:27:in `gem_original_require'
>>          from /usr/local/lib/ruby/site_ruby/1.8/rubygems/
>> custom_require.rb:27:in `require'
>>          from run.rb:10
>>
>> Then, when I changed all of the prop_accessor to attr_accessor, I get
>> this error instead, which I don't entirely get.
>>
>> matt-roses-computer:~/ruby/start mattrose$ nitro
>> /Users/mattrose/ruby/start/model.rb:28: uninitialized constant
>> User::Article (NameError)
>>          from /usr/local/lib/ruby/site_ruby/1.8/rubygems/
>> custom_require.rb:27:in `gem_original_require'
>>          from /usr/local/lib/ruby/site_ruby/1.8/rubygems/
>> custom_require.rb:27:in `require'
>>          from run.rb:10
>>
>> Here's the code.  Can someone tell me what I'm doing wrong?  This
>> used to work fine.
>>
>> class Blog
>> 	attr_accessor :title, String
>> 	attr_accessor :description, String
>> 	has_many :users, User
>> 	has_many :articles, Article
>> 	def initialize(title,description)
>> 	  @title, at description = title,description
>> 	end
>> 	def to_s
>> 	  @title
>> 	end
>> end
>> class User
>> 	attr_accessor :username
>> 	attr_accessor :password
>> 	has_many :articles, Article
>> 	belongs_to :blog, Blog
>> 	def initialize(username,password,blog)
>> 	  @username, at password, at blog_oid = username,password,blog
>> 	end
>> 	def to_s
>> 	  @username
>> 	end
>> end
>>
>> class Article
>>    attr_accessor :title
>>    attr_accessor :body
>>    #has_many :comments
>>    belongs_to :blog, Blog
>>    belongs_to :user, User
>>    def initialize(title,body,user,blog)
>>      @title, at body, at user_oid, at blog_oid = title,body,user,blog
>>    end
>>    def to_s
>>      @title
>>    end
>> end
>
> Am I right in thinking that if you want Og to persist an attribute you
> _must_ give the class annotation? I think that's part of the change
> from prop to attr.
>
> T.
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general



More information about the Nitro-general mailing list