Search code examples
ruby-on-railsruby-on-rails-3slim-lang

redirect to an item of edit page after creating object ruby


I need to redirect to a specific item in my edit page, I used redirect to but I can't add the #tab_id this is my source code :

  if @song.save
  flash[:notice] = I18n.t('message.success')
  #render action: 'edit'
  redirect_to edit_song_path(@song.id)#tablineT_18_5

the tab_id is named : '#tablineT_18_5'


Solution

  • Try something like,

    redirect_to edit_song_path(@song, :anchor => "tablineT_18_5")
    

    Also, check out this post https://stackoverflow.com/a/4981205/2403343