POST Form Basics
Form Arrays
Front End
Standard HTML
<form action="/subjects" method="post">
<input type="text" name="subject[name]">
<input type="text" name="subject[position]">
<input type="text" name="subject[visible]">
<input type="submit" value="Create Subject">
</form>
ERB with URL Helpers
<%= form_for(@subject) do |f| %>
<%= f.text_field(:name) %>
<%= f.text_field(:position) %>
<%= f.text_field(:visible) %>
<%= f.submit("Create Subject") %>
<% end %>
Rails
params[:subject][:name]
params[:subject][:position]
params[:subject][:visible]
params[:subject]
#=> { :name => 'About Us', :position => '5', :visible => '1' }
subject = Subject.new(params[:subject])
Published on 31 Mar 2020
all tags
100daysofcode activerecord android annoyances api apt arch array artix atom az3w backend bash blog browser bug callback career ci-cd cli cloud code coding config configuration cp crud cryptography css csv database db design devops django docker email erp feelsgood filter fugitive gif gist git gnome gnome pomodoro grep hebrew http ide isbn-fetcher iso javascript job search js kanban kindle koans learning linkedin linux logger manjaro map markdown microservices mobi mtp neovim nodejs nvchad packages panda pastbin patch portfolio post postgres pytest python rails reduce refactoring reflections rest routes rspec ruby salesforce script scripting security sed shell sql string_replacement study tdd terminal testing tmux ttd version_control vim vim sort walkthrough webdev workflow zsh