| 
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 | # File 'app/controllers/workarea/storefront/blog_entries_controller.rb', line 14
def 
  model = Content::BlogEntry.find_by(slug: params[:blog_entry_id])
  @entry = Storefront::BlogEntryViewModel.new(model, view_model_options)
  if current_user.public_info.blank?
    if params[:first_name].blank? || params[:last_name].blank?
      flash[:error] = 'First and last name are required'
      render(:show) && return
    else
      current_user.update_attributes(params.permit(:first_name, :last_name))
    end
  end
  @comment = model..build()
  if @comment.save
    flash[:success] = 'Your comment has been submitted. Thanks!'
    redirect_to blog_entry_path(@entry)
  else
    flash[:error] = 'There was a problem saving your comment.'
    render :show
  end
end |