ruby on rails - Question about editing by multiple Models and one controller -


I have three models (word, adjective, adverb) and a controller (word) that have these Models. I have to manage:

  def = edit word = Word.find (parameter [: id]) @ adjektiv = Adjektiv .find (parameter [: id]) @adverb = Adverb.find (Parameter for example: When I see an adverb of adverb (id = 1), and in the text box in Word with Eddie = 1, So I want to edit it. I like how can I do this to see Edwardb's first record? Thanks   

Since using STI (single table legacy), there are adjextitives and verb adjective words that look like an ideal situation, in order to obtain it, you will need a string field that will be used for your words The table has been typed. You can do it like this:

  def word & lt; ActiveRecord :: Base and Def Adjacquiv & lt; Word and Deaf Edwards & lt; Word and   

and then in your controller:

  def edit = word = word.find (params [: id]) end  < / Pre>  

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -