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
# How to get just the comment routes, and not the post routes | |
resources :posts do | |
resources :comments | |
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
@posts = @profile.posts # [] | |
@profile.posts.build | |
@posts # array containing a single post |
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
# config/initializers/devise.rb | |
config.mailer = DeviseMailer |
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
class Conversation < ActiveRecord::Base | |
has_many :messages | |
has_many :participants | |
has_many :users, :through => :participants | |
accepts_nested_attributes_for :messages | |
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
<% if @post.errors.any? %> | |
var errors = ''; | |
<% @comment.errors.full_messages.each do |error| %> | |
errors.append("<%= escape_javascript( error ) %>\n"); | |
<% end %> | |
alert(errors); | |
<% else %> | |
$('#posts').prepend('<%=j render 'chapters/posts/post', {:post => @post} %>') | |
<% 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
<% if @post.errors.any? %> | |
var errors = ''; | |
<% @comment.errors.full_messages.each do |error| %> | |
errors.append("<%= escape_javascript( error ) %>\n"); | |
<% end %> | |
alert(errors); | |
<% else %> | |
$('#posts').prepend('<%=j render 'chapters/posts/post', {:post => @post} %>') | |
<% end %> |
NewerOlder