Skip to content

How To: Test controllers with Rails 3 and 4 (and RSpec)

Ania Czekaj edited this page Oct 21, 2018 · 37 revisions
def create
  comment = PublicComment.new
  comment.resource_id = params[:Public_Comments][:resource_id]
  b = Booking.find(comment.resource_id)
  comment.body = params[:Public_Comments][:body]
  comment.resource_type = "Booking"
  comment.author_type = "AdminUser"
  # comment.author_id = current_user.id
  comment.namespace = "admin"
  comment.archived = false;
  byebug
  comment.save
  #Sendgrid email to user. b.user.email
  CommentMailer.notify_new_comment(b).deliver_now

  redirect_to admin_order_path(b), notice: 'Your comment has been added!'
end
Clone this wiki locally