summaryrefslogtreecommitdiffstats
path: root/tests/syntax-tests/highlighted/Ruby On Rails/test.rb
diff options
context:
space:
mode:
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