title: How to save data in rails with no form?
body: <p>I am new to rails and I am just learning the basics.
  This is my code on saving data:</p>
  
  <p><strong><em>app/controllers/employee_controller.rb</em></strong></p>
  
  <pre><code> class EmployeesController &lt; ApplicationController
  
      def index
        render json: @employees = Employee.all
      end
  
      def show
        render json: @employee = Employee.find(params[:id])
      end
  
      def new
        @employee = Employee.new
      end
  
      def create
         @employee = Employee.new(employee_params)
  
        @employee.save
        redirect_to @employee
      end
  
      private
         def employee_params
           params.require(:employee).permit(:fname, :mname, :lname, :contactno, :address, :username, :password)
         end
   end
  </code></pre>
  
  <p><strong><em>app/views/employees/new.html.erb</em></strong></p>
  
  <pre><code>&lt;%= form_for @employee do |f| %&gt;
  &lt;p&gt;
    &lt;label&gt;First Name&lt;/label&gt;&lt;br&gt;
    &lt;%= f.text_field :fname %&gt;
  &lt;/p&gt;
  &lt;p&gt;
    &lt;label&gt;Middle Name&lt;/label&gt;&lt;br&gt;
    &lt;%= f.text_field :mname %&gt;
  &lt;/p&gt;
  &lt;p&gt;
    &lt;label&gt;Last Name&lt;/label&gt;&lt;br&gt;
    &lt;%= f.text_field :lname %&gt;
  &lt;/p&gt;
  &lt;p&gt;
    &lt;label&gt;Contact No.&lt;/label&gt;&lt;br&gt;
    &lt;%= f.text_field :contactno %&gt;
  &lt;/p&gt;
  &lt;p&gt;
    &lt;label&gt;Address&lt;/label&gt;&lt;br&gt;
    &lt;%= f.text_area :address %&gt;
  &lt;/p&gt;
  &lt;br&gt;
  &lt;p&gt;
    &lt;label&gt;Username&lt;/label&gt;&lt;br&gt;
    &lt;%= f.text_field :username %&gt;
  &lt;/p&gt;
  &lt;p&gt;
    &lt;label&gt;Password&lt;/label&gt;&lt;br&gt;
    &lt;%= f.text_field :password %&gt;
  &lt;/p&gt;
  &lt;br&gt;
  
  &lt;p&gt;
    &lt;%= f.submit %&gt;
  &lt;/p&gt;
  </code></pre>
  
  
  
  <p>But, my goal is to save right away without the html form. (NO INPUT) Like when I visit a certain URL and the values are automatically saved in the database. <br/>
  For a start, I would like to assign a constant value in every field just to see how it works.</p>
  
  <p>Example,</p>
  
  <ul>
  <li>fname='sample name'</li>
  <li>mname='sampleMidName'</li>
  <li>lname='sampleLastName'
  and <em>etc...</em></li>
  </ul>
  
  <p>How can I assign those values right away after a certain URL/site is visited.</p>