Home>
Cannot save user_id
I thought I wanted to implement a nice feature, but before that I thought I didn't associate a post with a user_id
https://qiita.com/nojinoji/items/2c66499848d882c31ffa
An error occurs when trying to link user_id to a post referring to.
NameError in CommentsController # create
uninitialized constant Comment :: Like
Sample code
class CommentsController []})
end
end
class UserController
class User
class Comment
If i search with an error message, you cannot read the defined class.
https://qiita.com/imotan/items/c73fab5ee230114a08b6
Confirmed models/user as follows.
-
Answer # 1
Related articles
- ruby on rails - comment posting function actioncontroller :: urlgenerationerror
- ruby - i want to display the comment posting column with rails so that the comment list can be seen
- ruby on rails - i cannot save a comment on the comment posting page
- ruby - when posting an image, an error occurs where the image is not defined
- ruby on rails - userid is blank
- ruby - the header posting screen does not open only when transitioning from my page
- ruby - data is not stored when implementing the comment function
- ruby on rails - comment function deletion
- ruby on rails 5 - rails comment function is implemented asynchronously, but deletion does not work
- ruby - after posting an article on rails simple calendar, i want to reflect it on the calendar
- php - when i comment on a post on a non-membership posting site, i want to send a comment notification to the address entered in
- ruby - how to include user_id in the parameters of tagged posts
- ruby - i made a comment model, post model, user model relation with rails, but commentusername is a nil error
- ruby - image data is not registered in db by carrier wave image posting (not assigned to instance variable)
- i would like to add a comment function to the ruby on rails tutorial undefined method `coments' appears and cannot be solved
- ruby on rails - regarding the relationship of user_id in the seed file
- ruby - if you try to delete a comment post, you will get an error `destroy' for nil:nilclass please solve it
- ruby - when deleting a post, i want to delete the comment associated with the model together
- ruby on rails 5 - some items are not saved in db when posting from rails form
- ruby on rails - i can't comment out using htmlerb begin
Related questions
- ruby - passing variables using render partial
- ruby - gem devise (top page (login form input)) → list screen
- ruby - i get an error with the rails new command
- ruby - implementation of friendly forwarding
- ruby - i installed carrierwave with rails, but i can't see the image
- ruby - about rails controller new action
- ruby - rails page does not open
- [ruby] i'm having trouble with nomethoderror
- ruby - [search function] acquisition of products associated with users
- ruby - even if each statement is used, the contents of the db cannot be displayed in order and an error occurs
Isn't model like being made?