Nothing is being inserted into the database...help!

Hello all,

for some reason nothing is being inserted into the database. I have no
idea why not! Here is my action:

def create
@information = CalorieKing.new
@information = CalorieKing.get_information(params[:id])
@information = @information[‘food’][‘servings’]
@information[‘serving’].each do |s|
if s[‘name’] == params[:portion_type]
s[‘nutrients’].each do |value|
value *= params[:size]
end
puts ‘hello’
@foodentry = FoodEntry.new(:user_id => current_user.id,
:name => s[‘name’], :serving_size => params[:size],
:serving_name => params[:portion_type], :calories =>
s[‘nutrients’][‘caloires’],
:fat => s[‘nutrients’][‘fat’], :carbs => s[‘nutrients’][‘carb’],
:protein => s[‘nutrients’][‘protein’], :fiber =>
s[‘nutrients’][‘fiber’],
:sugar => s[‘nutrients’][‘sugar’], :sodium =>
s[‘nutrients’][‘sodium’],
:calcium => s[‘nutrients’][‘calcium’], :satfat =>
s[‘nutrients’][‘satfat’],
:cholesterol => s[‘nutrients’][‘cholesterol’])
@foodentry.save
puts ‘hello’
end
end
respond_to do |format|
format.html { redirect_to(food_diary_path) }
format.xml { head :ok }
end
end

Thanks!

for some reason nothing is being inserted into the database. I have no
idea why not! Here is my action:

The most common cause is that validations are failing, and you’re just
not seeing that.

– gw

And your controller should be put on a diet…

http://digiprof.tv

On 4 Sep, 20:23, Zack N. [email protected] wrote:

Hello all,

for some reason nothing is being inserted into the database. I have no
idea why not! Here is my action:

Did you check for any validations failing

Fred

Frederick C. wrote:

On 4 Sep, 20:23, Zack N. [email protected] wrote:

Hello all,

for some reason nothing is being inserted into the database. I have no
idea why not! Here is my action:

Did you check for any validations failing

Fred

Yep sorry, Iv been busy and hadnt checked my email for replies. You guys
were right I had a type in the name of my validation so i fixed it and
now it works great! Of course my controller needs to loose some weight,
i just need to get the app working and show the client a working copy
then im going refractor pretty much all my code!