Ruby on Rails - ActiveRecord::Base.transaction, no id on show action -


i have form allows user input keyword on each line on text box, split , create seperate records each word.

i using following activerecord::base.transaction ensure validation met , records added if validation passes each keyword entered.

respond_to |format|   begin     activerecord::base.transaction       @keywords.each &:save!       logger.info @keywords       format.js   { render action: 'show', status: :created, location: group_keywords_path }     end   rescue activerecord::activerecorderror => e     format.js   { render json: @keyword.errors, status: :unprocessable_entity }   end end 

the problem having this, on show.js.erb, @keyword doesn't have id has of other data, why?

if log output of @keywords before render show action can see following

[#<keyword id: 141, group_id: 14, keyword: "a keyword", created_at: "2015-06-15 11:28:31", updated_at: "2015-06-15 11:28:31">]

why isn't id being passed on?


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -