Ariff Munshi

Joined

11,280 Experience
99 Lessons Completed
1 Question Solved

Activity

Thanks Chris!

thanks for the reply Chris Oliver!

Most of the examples I saw were using has_many relationships so I guessed I missed it.

There are examples tho that I've seen in strong params:

def forum_thread_params
params.require(:forum_thread).permit(:subject, forum_posts_attributes: [:id, :body])
end

is including the :id necessary?

I have tried this but seem to have a problem.

When I do:

def new
@post = Post.new
@post.content.build
end

I get a undefined method 'build' for nil:class

but it will work if I do this:

def new
@post = Post.new
@post.build_content
end

My models:

Post.rb
has_one: :content, dependent: :destroy
accepts_nested_attributes_for :content

Content.rb
belongs_to :post

Any ideas why?

Posted in File Uploads with Refile Discussion

Thanks Chris! Look forward to using it!

Posted in File Uploads with Refile Discussion

Great video! Still deciding between carrierwave and refile tho since it's still new and carrierwave's wiki is filled with howtos. Btw, I think you missed out on the uploading via url part. :)

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.