ruby on rails - How to avoid `ActiveRecordObject(#69859840542640) expected, got String(#19082040)` -


i understand that, had belongs_to :activerecordobject ain active record model , following in partial _form.html:

  <div class="field">     <%= f.label :activerecordobject %><br>     <%= f.text_field :activerecordobject %>   </div> 

so hit error:

activerecordobject(#69859840542640) expected, got string(#19082040)

i don't want change activerecordobject else yet accept string, how can that?

note: tried attr_accessor same name.

i use: book -> author.

view edit author:   <div class="field">   <%= f.label :author_id %><br>   <%= collection_select(:book, :author_id, author.all, :id, :full_name, {}, {:class=>'form-control', :style => 'width: 25%'}) %>   </div> 

view show book:

<p>   <strong>autor:</strong>   <%= @book.author.full_name %> </p>  in model author:    def full_name     "#{first_name} #{last_name}"   end 

i hope help


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -