Railsde ‘Create Post‘ Ve Sonrası
-
Arkadaşlar sayfada yeni post oluştur butonu var ve jquery ile yapılmış form kutucugu çıkıyor. yeni bir post oluşturabiliyorum. sonrasında show sayfasına yönlendiriyor ve orada görebiliyorum ne girdiysem show sayfasında ve geri linkine tıkladıgım zaman indexe döndüğümde script kapanmış oluyor, bütün form kutucugunu sayfanın en tepesinde görüyorum. nerede hata yapıyor olabilirim ?show.html.erb
<%= link_to 'Geri', :controller => "smashbucklers" %>
SmashbucklersController dosyasi
def show
end
def new
@smashbuckler = Smashbuckler.new
enddef create
@smashbuckler = Smashbuckler.new(smashbuckler_params)
respond_to do |format|
if @smashbuckler.save
format.html { redirect_to @smashbuckler, notice: 'Post tanitildi.' }
else
format.html { render action: 'index' }
end
endend
Rake:routes
smashbucklers GET /smashbucklers(.:format) smashbucklers#index
POST /smashbucklers(.:format) smashbucklers#create
new_smashbuckler GET /smashbucklers/new(.:format) smashbucklers#new
edit_smashbuckler GET /smashbucklers/:id/edit(.:format) smashbucklers#edit
smashbuckler GET /smashbucklers/:id(.:format) smashbucklers#show
PATCH /smashbucklers/:id(.:format) smashbucklers#update
PUT /smashbucklers/:id(.:format) smashbucklers#update
DELETE /smashbucklers/:id(.:format) smashbucklers#destroy -
hocam sorununu doğru anladım mı emin değilim ama index.html.erb dosyasına aşağıdaki kodu ekleyip dener misin?
<meta http-equiv="pragma" content="no-cache">
-
show'un içi neden boş ?
-
Dark_Lord bunu yazdı
show'un içi neden boş ?
show metodunda herhangi bir işlem yapmıyorum
html.erb de yapıyorum
@smok3 olmadı hocam
-
Arkadaşlar yaptım.
http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to
bu linkte açıkladıgı üzere,
<%= link_to "Geri", smashbucklers_path, method: :get %>
koymak yeterliymiş
teşekkürler saolun yinede
