Skip to content

Instantly share code, notes, and snippets.

@mooru
Last active December 26, 2015 23:48
Show Gist options
  • Select an option

  • Save mooru/7232637 to your computer and use it in GitHub Desktop.

Select an option

Save mooru/7232637 to your computer and use it in GitHub Desktop.
<h2><%= link_to 'Membership Profile', members_url %></h2>
<%= simple_form_for @member do |f| %>
<%= f.input :first_name %>
<%= f.input :middle_name %>
<%= f.input :last_name %>
<%= f.input :address %>
<%= f.input :tel_no, placeholder: 'best contact phone number', hint: 'Add 234 to your number'%>
<%= f.input :email, placeholder: 'enter a valid email' %>
<%= f.input :gender_id, collection: ['Male', 'Female'] %>
<%= f.input :birth, as: :date, start_year: Date.today.year - 57,
end_year: Date.today.year - -13, discard_day: false,
order: [:month, :day] %>
<%= f.input :marital_status_id, collection: ['Married', 'Single'], prompt: "Select Your Status" %>
<%= f.input :age_id, collection: ['Adult', 'Youth', 'Teens'], prompt: "Select Group" %>
<%= f.input :occupation_id, collection: ['Working Class', 'Self Employed', 'Business Owner', 'NYSC', 'Student'], prompt: "Select Occupation" %>
<%= f.input :membership_id, collection: ['Regular Member', 'Children', 'ICL', 'Guest', 'Community'], prompt: "Select Membership Status" %>
<%= f.input :ministry_id, collection: ["Pastor", "Minister", "Leader", "Worker"], prompt: "Select Ministry Role" %>
<%= f.input :department_id, collection: ['Prayer', 'Evangelism', 'Ushering', 'KYC', 'Music', 'Training', "Children's Ministry", 'Parking', 'Sound And Media', 'Small Groups'], prompt: "Select Department" %>
<%= f.input :church_id, collection: ['Oregun', 'Alagbado', 'Oko-oba', 'Lekki', 'Igando', 'Ijebu-Ode', 'Abeokuta', 'Ibadan', 'Campus'], prompt: "Select Church" %>
<%= f.button :submit, 'Submit', class: "btn btn-primary btn-lg" %>
<% end %>
Controller
class MembersController < ApplicationController
def new
@member = Member.new
end
def create
@member = Member.new(member_params)
@member.save
end
def member_params
params.require(:member).permit(
:first_name,
:middle_name,
:last_name,
:tel_no,
:email,
:birth,
:age_id,
:occupation_id,
:membership_id,
:gender_id,
:department_id,
:church_id,
:marital_status_id,
:ministry_id
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment