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 6336921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:09:10+00:00 2026-05-24T19:09:10+00:00

I have a simple model entity, called entry with one field content and on

  • 0

I have a simple model entity, called “entry” with one field “content” and on save or update I want to process that content.

But in the models’ method the member variable @content is nil, in the controller function it’s still set.

entries_controller.rb

   def create
    @entry = Entry.new(params[:entry])

    respond_to do |format|

      if @entry.save
         #@entry.process
         @entry.splitwords

entry.rb

class Entry < ActiveRecord::Base

  def splitwords
    logger.debug "content: #{@content.inspect} "

    words = @content.split(" ")
    ...

and that’s from the log

entry: #<Entry id: 6, content: "Air-Berlin-Vorstandschef Joachim Hunold legt sein A...", created_at: "2011-08-18 09:30:52", updated_at: "2011-08-18 09:30:52"> 
content: nil 

So why is @content not set inside an entry ??

  • 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-24T19:09:11+00:00Added an answer on May 24, 2026 at 7:09 pm

    Your problem is @content, which is indeed not defined in your model. What you want is to call “content” or “self.content” if you want. So your code would be:

      def splitwords
        logger.debug "content: #{content.inspect} "
    
        words = content.split(" ")
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rather simple data model, but I have a centric entity called
I have a simple Coredata model with one entity called conversation and the other
I have a simple db.Model , that has one of the fields db.ListProperty(users.User) For
I have a simple model, consisting of a document that references one or more
We have a simple domain model: Contact, TelephoneNumber and ContactRepository. Contact is entity, it
I have a simple model called Party with a corresponding table called parties .
I have a simple model like this one: class Artist(models.Model): surname = models.CharField(max_length=200) name
i have very simple problem. I need to create model, that represent element of
I got a simple problem in SQLAlchemy. I have one model in a table,
I have created a very simple Entity Framework 4.0 model using VS2010 Professional. Ignore

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.