Answer the question
In order to leave comments, you need to log in
Data sampling for the user?
There are tables
user (:id, :username)
follow (:user_id(кто подписался), :following(на кого подписался), :status(статус подписки))
image (:image, :user_id)
comment (:image_id, :user_id, :text)
repost (:user_id, :image_id).
@news = User.where('users.id = ?', params[:user][:id]).includes(:images, :reposts).first
object @news
attributes :id, :username
child(:images) do
attributes :id, :image
child(:comments) do
attributes :id, :text
child(:user) {attributes :id, :username}
end
end
child(:reposts) do
child(:image) do
attributes :id, :image
child(:user) {attributes :id, :username}
child(:comments) do
attributes :id, :text
child(:user) {attributes :id, :username}
end
end
end
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question