Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6799683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:52:40+00:00 2026-05-26T18:52:40+00:00

I have a model ProductFeature a controller called product_feature_controller.rb I am writing the ‘edit’

  • 0

I have a model ProductFeature

a controller called product_feature_controller.rb

I am writing the ‘edit’ method of my CRUD for this controller. In the edit method, I created an instance variable named @productFeature and set it equal to ProductFeature.find(:id) and I send this instance variable to my view to be used by a form_for(:product_feature). I have found that my form will not populate its fields with the current data from the record I am pulling up. After pulling hairs for some hours, it dawned on me that my error was all in the way named my instance variable.

It should be named @product_feature instead of @productFeature. This seems like a trivial detail, but I’d really like to know why this is the case. How does this even work? I mean how does Rails know to populate my form based on the way the instance Variable is named? I hope my question is clear, just seeking further edification.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:52:40+00:00Added an answer on May 26, 2026 at 6:52 pm

    Because the symbol :product_feature (in the form_for) is going to look up an instance variable based on that symbol. It doesn’t do any transformation, and will be looking for a @product_feature variable. As long as they match, you should be okay, but the Ruby world uses underscores between words.

    Also, models should be named with a leading capital, ProductFeature, by convention. I don’t know if this will cause any issues, but it’s counter to the norm.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have model/controller called notification. I want to make a new url so that
In my controller I have model operations that can return empty results. I've setup
I am newbie at Django. I have model with a custom method. In view
I have a model Question with a field called userid , before one ask
I have model with a Foreign Key to itself like this: class Concept(models.Model): name
I have model called test, and test can have many tests, and should be
I have model like this: class Kaart(models.Model): name = models.CharField(max_length=200, verbose_name=Kaardi peakiri, help_text=Sisesta kaardi
I have model called Product and it has the following columns: create_table :products do
I have model User. And one of controller methods is def view_messages @user =
I have model called User with a has_many relationship to UserFilter . UserFilter has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.