Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMichael Nickey
Courses Plus Student 13,524 PointsCannot create a new post
After migrating the devise views I see this error. I want to get simple_form working and need help resolving this. Any help would be greatly appreciated. Thanks in advance https://github.com/mnickey/Treebook.git
Error: undefined method `name' for #<Status:0x007f98954d7b20> Extracted source (around line #16):
13 14 <div class="field"> 15 <%= f.label :name %><br> 16 <%= f.text_field :name %> 17 </div> 18 <div class="field"> 19 <%= f.label :content %><br>
Trace of template inclusion: app/views/statuses/new.html.erb
Rails.root: /Users/MNickey/Desktop/Web_portfolio/Treebook
Application Trace | Framework Trace | Full Trace app/views/statuses/form.html.erb:16:in `block in _app_views_statusesform_html_erb3689544168837814361_70146658284980' app/views/statuses/_form.html.erb:1:in `_app_views_statusesform_html_erb_3689544168837814361_70146658284980' app/views/statuses/new.html.erb:3:in `_app_views_statuses_new_html_erb_2815333058588870765_70146658145060'
2 Answers
Tommy Morgan
Treehouse Guest TeacherHey Michael Nickey -
Looking over your code, it looks like the problem is that you don't have a name
field on your status model (you used to have it, but then you removed it in this commit). Because you're trying to reference that field (with <%= f.text_field :name %>
) but it doesn't exist, Rails is throwing an error.
Hopefully that helps :)
Michael Nickey
Courses Plus Student 13,524 PointsStill looking for more help on this...
I'm thinking of scraping and rebooting the entire process. One thing I'd like to know beforehand though is what version of RoR is this using?
The reason I ask is because I currently am using version 4 which is why I was running into issues with the refresh and hover effects. It seems that this version includes a gem called 'TurboLinks' which caches pages for faster use. Once this was removed (commented out) it resolved the issue.
However, since I am using RoR version 4 I want to know two things. 1) Since this project is about halfway done, can I switch back to an older version and if so how? I expect that since some of the code is already done in version 4 it may cause errors... 2) What version of RoR is the Treebook app using? If I start over I'd like to make sure that I use the proper version so I can finally finish this project.
Thanks in advance! :)
Michael Nickey
Courses Plus Student 13,524 PointsMichael Nickey
Courses Plus Student 13,524 PointsSo I thought the same thing but even when I comment out the line, save it, do a 'rake db:migrate', refresh I get the same error:
undefined method `name' for #<Status:0x007fc67bb02fb8>
add_user_id_to_statuses.rb