search for: article_path

Displaying 3 results from an estimated 3 matches for "article_path".

2007 May 09
1
How can I change a form's onsubmit event handler using rjs?
...e new model is created. But if I submit the form for the second time, I want to update the formerly created model using an Ajax post. I think I could render an rjs at the end of the first submit action and the rjs should change the onsubmit event handler of the form, say: page[:form][:onsubmit] = article_path(@article) but it seems that this doesn''t work. Another problem is that "article_path(@article)" will generate something like "/article/12" with HTTP PUT method, but I need something like "new Ajax.Request(...)". Any idea about these two questions? Thanks. -...
2007 Jul 15
0
errors_for
...ound this was real easy to port over, so I thought I''d share. It doesn''t highlight the field with the error, but it gives that same nice little div on top. Say I had an articles controller def create @article = Article.new(params[:article]) @article.save! redirect article_path(@article) rescue render :action => ''new'' end I would catch the activerecord exception there with the rescue Then in global_helper.rb, I add the error_messages_for method. This is taken from rails and stripped of some of its pieces like content_tag and pluralize. I...
2009 Sep 19
2
MethodNotAllowed
...;%= f.submit "Update" %> <% end %> My controller has the following code: def edit @source = @article.sources.find(params[:id]) end def update @source = @article.sources.find(params[:id]) if @source.update_attributes(params[:source]) flash[:notice]... redirect_to article_path(@article) #@article is derived from before filter else render :action => "edit" end end Any suggestions? Thanks for you help!!! -Kevin