[Nitro] nitro 0.40.0 changes?
Matt Rose
mattrose at folkwolf.net
Thu Nov 16 20:20:06 EST 2006
Sorry to be a bother about this guys, but now I'm getting an error
message. I kind of suspected this would happen, because of the params.
How did we decide parameters would be called now in the action now?
I have a setup page that takes form input, and passes it as GET
params back to the same page. When I pass it no params, it works
great, but when I try and pass it params via a GET request, I get this:
http://localhost:9000/setup?title=masterblog&desc=master
+blog&user=matt&pass=pass
Path: /setup
Wrong parameter count for setup().
the setup function in the controller looks like this:
def setup
p request.params
blogs = Blog.all
p @blogs
#should only be able to go here when there's nothing setup
if request.params.empty? && Master.all.empty?
@render_master_form = true
end
if request.params.values.length == 4 && Master.all.empty?
Master.create(*request.params.values)
end
p Master.find_one
@master = Master.find_one
if request.params.length == 2
Blog.create(*request.params.values)
end
end
The request.params hash even shows up in the webrick output when I
issue the GET request, but I still get that error.
TIA.
Again. This code *used* to work fine. I looked through the
migration document, and even took an admittedly cursory look through
the source code, and mailing list archives to figure out how to fix
this.
Sigh. I know everybody's trying their damnedest, and I know that
Nitro is kind of a moving target right now, but, damn.
Off to pore through Nitro code. I'll learn all this shit somehow.
Boy I'm whiny this week :)
On 15-Nov-06, at 11:08 PM, transfire at gmail.com wrote:
>
> Matt Rose wrote:
>> 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 understand the feeling. It can be frustrating. And Nitro's been
> going
> through a lot of changes over the last year. But thankfully with this
> and the next release that looks to finally settle down.
>
>> 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
>
> I'm thinking Master is not getting "enchanted" by Og. Try adding the
> class types:
>
> class Master
> attr_accessor :title, String
> attr_accessor :description, String
> attr_accessor :user, String
> attr_accessor :pass, String
> def initialize(title,desc,user,pass)
> @title, at description, at user, at pass = title,desc,user,pass
> end
> def to_s
> @title
> end
> end
>
> And see how that effects it.
>
> 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