Development Environment: CentOS 6.5; Ruby 2.1.1; Rails 4.1.0.rc2
Novice RoR developer, experienced in other programming languages
Learning from/following the www.railstutorial.org online book
I am trying to figure out if and how to use the url: and html: modifiers with the "form_for" helper function. Looking at other posts, here on stackoverflow, the closest I have found and used as a reference is Here.
My Controller has
def apply
@applicant = Applicant.new
end
The view (apply.html.erb) has
<div class="row">
<div class="span6 offset3">
<%= form_for (@applicant) do |f| %>
<%= f.label :sName, "Short Name" %>
<%= f.text_field :sName %>
and the routes.rb file has
match '/membership/apply', to: 'membership#apply', via: 'get'
match '/membership/submitted', to: 'membership#submit', via: 'post'
match '/membership/pre_approve', to: 'membership#pre_approval', via: 'put'
match '/membership/finalize_app', to: 'membership#finalize_app', via: 'put'
match '/membership/approve', to: 'membership#approve', via: 'post'
match '/membership/endorse', to: 'membership#endorse', via: 'put'
match '/membership/status', to: 'membership#status', via: 'get'
when I visit localhost:3000/membership/apply, I get the following error-
undefined method 'applicants_path' for #
and when I've tried using the url: and html: hashes -
<%= form_for (@applicant), url: membership, html: { method: :get } do |f| %>
I then receive the error-
undefined local variable or method 'membership' for #
Is this more of a routing issue with the route.rb file? Is the use of the url: and html: modifiers correct?