Ruby on Rails
Saturday, January 27, 2018
On Saturday, November 3, 2012 at 7:46:47 AM UTC-4, Fahim Patel wrote:
Hi all,from last 1 hour i am facing one problem.I have written a code for creating user and show them in index page after save.Code is working perfectly but on index page i am getting all record till second last record saved, but i am not getting current record which is saved.But in database my last record is saved successful.But when i restart the server , than on index page all record come with the last record .I dont know why this all is happening ?Code below######## controller codeclass AdminUsersController < ApplicationControllerdef new@admin = AdminUser.newenddef index@admins = AdminUser.allenddef create@admin = AdminUser.new(params[:admin_user]) if @admin.saveredirect_to admin_users_pathelserender "new"endendend######## new view############<%= form_for @admin do|f|%>First Name<%= f.text_field :first_name%><%= submit_tag"Create"%><% end %>######## index view############<%= @admins%>##############modelnothing in modelHope you all understand the problem .ThanksRegardsFahim Babar Patel
You're missing a respond_to do format block
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e5bafa50-f324-4a7f-b735-abf362d60543%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment