<commit_before>class InquiriesController < ApplicationController

	def index
		@inquiries = Inquiry.order("created_at")
	end

	def create
		@product = Product.find(params[:product_id])
		@inquiry = @product.inquiries.create(params[:inquiry].permit(:question))
		@inquiry.user_id = current_user.id if current_user
		@inquiry.save

		if @inquiry.save
			flash[:notice] = "Pregunta enviada con éxito!"
			redirect_to product_path(@product)
		else
			flash[:invalid] = "El campo de pregunta no puede ser vacío."
			redirect_to product_path(@product)
		end

	end

	def update
		@product = Product.find(params[:product_id])<commit_msg>elimina save innecesario<commit_after>class InquiriesController < ApplicationController

	def index
		@inquiries = Inquiry.order("created_at")
	end

	def create
		@product = Product.find(params[:product_id])
		@inquiry = @product.inquiries.create(params[:inquiry].permit(:question))
		@inquiry.user_id = current_user.id if current_user

		if @inquiry.save
			flash[:notice] = "Pregunta enviada con éxito!"
			redirect_to product_path(@product)
		else
			flash[:invalid] = "El campo de pregunta no puede ser vacío."
			redirect_to product_path(@product)
		end

	end

	def update
		@product = Product.find(params[:product_id])
{'fraction_non_alphanumeric': 0.10853950518754989, 'fraction_numerical': 0.0, 'mean_word_length': 5.057971014492754, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4809349', 'n_tokens_mistral': 458, 'n_tokens_neox': 412, 'n_words': 92}