summaryrefslogtreecommitdiffstats
path: root/tests/syntax-tests/highlighted/Ruby On Rails/test.rb
diff options
context:
space:
mode:
authorhenil <dedaniahenil@gmail.com>2020-11-15 00:22:08 +0530
committerDavid Peter <sharkdp@users.noreply.github.com>2020-11-23 15:43:58 +0100
commit591eba66a3af1c211a09eefd17cbeb819b0a131f (patch)
treecf0b604f97314d567745498c85be1aec36e85f25 /tests/syntax-tests/highlighted/Ruby On Rails/test.rb
parenta5a9ac83e5a506ac2bdc673476aca54c818eabe2 (diff)
add new syntax test filesv0.17.0
Diffstat (limited to 'tests/syntax-tests/highlighted/Ruby On Rails/test.rb')
-rw-r--r--tests/syntax-tests/highlighted/Ruby On Rails/test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/syntax-tests/highlighted/Ruby On Rails/test.rb b/tests/syntax-tests/highlighted/Ruby On Rails/test.rb
new file mode 100644
index 00000000..9b2a9b66
--- /dev/null
+++ b/tests/syntax-tests/highlighted/Ruby On Rails/test.rb
@@ -0,0 +1,22 @@
+class ContactsController < ApplicationController
+ def new
+ @contact = Contact.new
+ end
+
+ def create
+ @contact = Contact.new(secure_params)
+ if @contact.valid?
+ UserMailer.contact_email(@contact).deliver_now
+ flash[:notice] = "Message sent from #{@contact.name}."
+ redirect_to root_path
+ else
+ render :new
+ end
+ end
+
+ private
+
+ def secure_params
+ params.require(:contact).permit(:name, :email, :content)
+ end
+end