my project is about German language( that save the German words). I have three Tables (Word for Nammen, Adverb for adverbs,Adjektiv for Adjectivs and Adverb for Adverbs) of course in my scnario(thst is not optimal) there is no realation between Tables.I have one form that user can add adverb OR adjective or....(see:Download ba)i use accordion and each one has a tab in accordion i want to give a possibility to user to edit one record in that page.but when the user click on a record to edit,another records with the same ID too appear in another tabs(see:Download ba) how can i avoid that? this is my controller:
class WordsController < ApplicationController def new @word=Word.new @verb=Verb.new @adjektiv=Adjektiv.new @adverb=Adverb.new end def create @word=Word.create(params[:word]) @verb=Verb.create(params[:verb]) @adjektiv=Adjektiv.create(params[:adjektiv]) @adverb=Adverb.create(params[:adverb])
if @word.save || @verb.save || @adjektiv || @adverb redirect_to :action => 'index' else render :action => 'new' end end def index @word=Word.find(:all) @verb=Verb.find(:all) @adjektiv=Adjektiv.find(:all) @adverb =Adverb.find(:all) end def edit @word=Word.find(params[:id]) @verb=Verb.find(params[:id]) @adjektiv=Adjektiv.find(params[:id]) @adverb =Adverb.find(params[:id]) end def update @word =Word.find(params[:id]) if @word.update_attributes(params[:word]) || @verb.update_attributes(params[:verb]) || @adjektiv.update_attributes(params[:adjektiv]) || @adverb.update_attributes(params[:adverb]) redirect_to :action => 'index' else redirect_to :action => 'edit' end end end
thank you for your help