Ask A Question

Notifications

You’re not receiving notifications from this thread.

rendering issue

Matthew J Martin asked in Rails
OK, so I fairly new at rails, but i'm at the point where i feel confidence enough to start making my own side project which i decide would be a clone of facebook in rails. first i'm working on is getting status updates working. I got it setup as the StatusUpdate is a model that tobe called by the Pages controller to render on the index page, now the issue I'm having is I use form_for(@status_update) command I get 
undefined method `to_key' for #<StatusUpdate::ActiveRecord_Relation:0x00000000049d3448>
Did you mean?  to_set
               to_ary
if i use form_with(model: @status_update) 
undefined method `to_model' for #<StatusUpdate::ActiveRecord_Relation:0x000000000471cd80>
Did you mean?  to_xml
If i use form_with(model: status_update)

undefined local variable or method `status_update' for #<#<Class:0x0000000005801678>:0x0000000002ec8ec8>
Did you mean?  @status_update

I'm just getting a little fustrated with this.


Reply
What did you set `@status_update` to in your controller's action?
Reply
in my home page
def home
 @status_update = StatusUpdate.new
end
Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 79,047+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2023 GoRails, LLC. All rights reserved.