Ok, so I upgraded to Merb 1.0.1 and DataMapper 0.9.7. The thing is
that now the update function of my controller is completely broken.
Let me explain better.
I'm doing some very basic stuff. I create my app, set up the database
and then generate my resource with:
merb-gen resource article title:string,author:string
I then ran the rake db:automigrate command, to sync my database. After
that I've created my views following exactly the examples listed here:
Then I proceed to actually create my first content. All's fine. The
record is created and correctly displayed. Still, when I go and edit
it the data isn't saved. Let me clarify that I haven't touched a
single thing in my controller.
"It could be a DataMapper problem", I thought. So i ran "merb -i" and
tried to do stuff from there:
Article.get(1).update_attributes(:title => "My new title")
And the record gets updated just fine. By the way, the problems
persists even if I use ActiveRecord.
So I've tried to se if it was a merb problem by modifying the update
method of my controller like this, you know just to do some
experiments to get at least a hint of what's going on:
def update(id, article)
@article = Article.get(id)
raise NotFound unless @article
if @article.update_attributes(:title => "bla bla bla")
display @article, :edit
The record is updated again, and "bla bla bla" is my new title. Then I
restored the fourth line of the code posted above to what's
automatically generated by merb-gen:
Again, nothing saved. It seems to me like the article variable isn't
read by the @article.update_attributes function, at all :/
What could be wrong? I've updated all the gems, and I've done some
very basic stuff, with no models relationships established, nor
validations etc... Any ideas about this very weird behaviour?
Thankyou so much in advance.