plebaba-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2009-Mar-25 02:41 UTC
Couldn''t find without an ID
hello , i have problem when i want to show page after user submit data into database. this is code in controller>>>class ComponentsController < ApplicationController def index end def databases @title = "Database" if request.post?and params[:seq] params[:seq][:sequence].gsub!(/\s/,"") params[:seq][:sequence].upcase! @seq = Seq.new(params[:seq]) if @seq.save flash[:notice] = "sequence submitted !" redirect_to :action => "show" end end end def show @title = "Show" @seq = Seq.find(params[:id]) end end end>>when i run i have error like isActiveRecord::RecordNotFound in ComponentsController#show Couldn''t find Seq without an ID /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ base.rb:1572:in `find_from_ids'' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ base.rb:616:in `find'' /home/apple/www/rcc_eri/app/controllers/components_controller.rb:29:in `show''>> pls, what i miss.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
it is not> redirect_to :action => "show"BUT : redirect_to :action => "show", :id => @seq.id Good Luck, Reinhart company : be-barefoot.com Thiti Panya wrote:> hello , > i have problem when i want to show page after user submit data into > database. > this is code in controller >>>> > class ComponentsController < ApplicationController > > def index > end > > def databases > @title = "Database" > if request.post?and params[:seq] > params[:seq][:sequence].gsub!(/\s/,"") > params[:seq][:sequence].upcase! > @seq = Seq.new(params[:seq]) > if @seq.save > flash[:notice] = "sequence submitted !" > redirect_to :action => "show" > end > end > end > > def show > @title = "Show" > @seq = Seq.find(params[:id]) > end > end > end > >>>when i run i have error like is > ActiveRecord::RecordNotFound in ComponentsController#show > Couldn''t find Seq without an ID > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ > base.rb:1572:in `find_from_ids'' > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ > base.rb:616:in `find'' > /home/apple/www/rcc_eri/app/controllers/components_controller.rb:29:in > `show''-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
thank you very much Reinhart it'' work. -___- 2009/3/25 Rails Terrorist <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>> > it is not > > redirect_to :action => "show" > > BUT : > redirect_to :action => "show", :id => @seq.id > > Good Luck, > Reinhart > company : be-barefoot.com > > Thiti Panya wrote: > > hello , > > i have problem when i want to show page after user submit data into > > database. > > this is code in controller > >>>> > > class ComponentsController < ApplicationController > > > > def index > > end > > > > def databases > > @title = "Database" > > if request.post?and params[:seq] > > params[:seq][:sequence].gsub!(/\s/,"") > > params[:seq][:sequence].upcase! > > @seq = Seq.new(params[:seq]) > > if @seq.save > > flash[:notice] = "sequence submitted !" > > redirect_to :action => "show" > > end > > end > > end > > > > def show > > @title = "Show" > > @seq = Seq.find(params[:id]) > > end > > end > > end > > > >>>when i run i have error like is > > ActiveRecord::RecordNotFound in ComponentsController#show > > Couldn''t find Seq without an ID > > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ > > base.rb:1572:in `find_from_ids'' > > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ > > base.rb:616:in `find'' > > /home/apple/www/rcc_eri/app/controllers/components_controller.rb:29:in > > `show'' > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---