This is the html:
<div id='aremark'>
<%= render :partial => 'comment' %>
</div>
<% remote_form_for :comment, :url=>story_comments_path(@story), :html
=> { :id => 'comment' } do |form| %>
<h5><label for="login">Make a comment:</label></h5>
<div id="body"><%= form.text_field :body %></div>
<p><%= submit_tag 'Comment' %></p>
<% end %>
The form works i.e on refreshing the page the new comment is seen in the
comment partial.
From comments_controller
def create
@story = Story.find(params[:story_id])
@story.comments.create params[:comment]
flash[:notice] = "Thank you for commenting"
end
This is create.rjs
<script>
aremark = page.getElementById("aremark")
page.replace_html('aremark', :partial => "content")
</script>
This was working then didn't. I don't know what I did to break it.
Can anybody see where I am going wrong?
--
Posted via http://www.ruby-forum.com/.
I want a form that accepts comments and adds them to a list without
refreshing the page.
page.replace_html('aremark', :partial => "content")
Still won't work without refreshing the page
Frederick Cheung wrote:
> On Jul 27, 8:56�pm, Neil Bye <li...@ruby-forum.com> wrote:
>> This is create.rjs
>>
>> <script>
>> aremark = page.getElementById("aremark")
>> page.replace_html('aremark', :partial => "content")
>> </script>
>>
> This is weird - if it's an rjs file you don't want script tags - an
> rjs file only contains ruby.
>
> Fred
--
Posted via http://www.ruby-forum.com/.
ActionView::MissingTemplate (Missing template comments/create.erb in
view path app/views):
Does that help anyone to explain
I don't understand, how would it find the rjs and if the
page.replace_htm is in the controller what would it contain?
I think this is the problem but I don't know the solution. Surely in the
absence of create.html.erb it should find create.rjs but
doesn't?????????????