-
-
Save trekdemo/1105176 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
helper_method :grand_parent, :parent, :resource | |
def grand_parent | |
end | |
def parent | |
@parent = params .... | |
end | |
def resource | |
@comment = params[:id] ? parent.comments.find( params[:id] ) : parent.comments.new( params[:comment] ) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# comments/_form.html.erb | |
<div class="new_comment"> | |
<% form_for [grand_parent, parent, resource ] do |f| %> | |
<%= error_messages @comment %> | |
<p><%= f.label :content, 'Szólj hozzá!' %> | |
<%= f.text_area :content, :class => 'text maxwidth' %></p> | |
<div class="submit_wrapper"> | |
<%= f.submit 'Elküldöm a hozzászólást' %> | |
</div> | |
<% end %> | |
</div> | |
# és ezt a paritalt vagy a messages/show-ból húzzuk be | |
# vagy a statuses/show-ból. és ennek megfelelően kell majd postolni és a kontrollerben pedig redirectelni |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment