Bugs related to Merb-Stack (Merb installed using gem install merb)
Generated:
def new only_provides :html @article = Article.new display Article end
def create(article) @article = Article.new(params[:article]) if @article.save redirect resource(@article), :message => {:notice => "Article was successfully created"} else render :new end end
def update(article) @article = Article.get(article[:id]) raise NotFound unless @article if @article.update_attributes(article) redirect resource(@article) else display @article, :edit end end
def destroy(id) @article = Article.get(id) raise NotFound unless @article if @article.destroy redirect resource(@articles) else raise InternalServerError end end
Should read:
def new only_provides :html @article = Article.new display @article end
def create(article) @article = Article.new(article) if @article.save redirect resource(@article), :message => {:notice => "Article was successfully created"} else render :new end end
def update(id, article) @article = Article.get(id) raise NotFound unless @article if @article.update_attributes(article) redirect resource(@article) else display @article, :edit end end
def destroy(id) @article = Article.get(id) raise NotFound unless @article if @article.destroy redirect resource(:articles) else raise InternalServerError end end
(fixed in the development branch)
merb-gen resource article title:string,author:string
the generated model has a return carriage issue
Generated code:
class Article include DataMapper::Resource property :id, Serial property :title, String property :author, String end
Should read:
class Article include DataMapper::Resource property :id, Serial property :title, String property :author, String end
(fixed in the development branch)