I’ve just started learning ruby, so this question is simple.
I created @subject in controller.
Why is :subject used in form_for (instead of @subject)?
<%= form_for(:subject, :url => {:action => 'create'}) do |f| %>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is similar to the assigns in rspec rails testing (you can look it up, assigns(:subject) will seek out for a @subject in your controller). Correct me if I am wrong but I think it is because the symbol :subject will try to seek out for an instance variable in your controller that correspond with @subject. So to prove it, rename your @subject in your controller to something else, like @subjectz and I think it won’t work anymroe