A safety-intervention officer at Kolb Middle School found the gun in the teen's backpack last week.
No one was hurt.
Parents were notified about the incident in a recorded message from the school's principal.
The incident happened last Monday after lunch. As soon as other students notified school administration, campus security moved in, took possession of the weapon, and called police.
The student who brought the gun to school was arrested, but police were not able to interview him immediately because of rules regarding the interrogation of minors.
Exactly why he brought the loaded gun to school is still unclear.
"The student brought a gun on campus, and it wasn't the intent to use it, the intent was probably show and tell. Not something that a student should be bringing on campus," said Syeda Jafari, a spokeswoman with the Rialto Unified School District.
School officials say this is a perfect example of why it's so important for students to report anything unusual to a teacher or another staff member.
"I think the message here is that we really need to let our parents and guardians know that please, before you drop off your students to school, make sure you are checking their backpacks, having conversations, communicating, making sure that you're asking their child about their social emotional connection before they get to school," Jafari said.
Parents said they were alarmed and scared when they heard about the incident, but they're also relieved that no one was injured.
"It's always a little scary to hear that there's a weapon on campus," said one parent, who wished to remain anonymous.
She said as soon as she got a recorded message from the school principal, it was something she definitely wanted to discuss with her seventh-grade daughter.
"I talked to her about how important it is to talk about it if you hear something, even if it's a rumor, even if you think it's a lie, communicate with the staff there, because it's better to lose a friend and be afraid that your friends will be mad at you, but you're going to lose a friend, instead of losing someone's life if this case could have been different," she said.
MORE | Therapist offers free sessions to kids touched by gun violence: 'They are scared'