Welcome to the Treehouse Community
Looking to learn something new?
Jon Moss1,150 Points
Form & URL Parameters
Hi, I am trying to use URL parameters as well as the Rails form fields...
def new @entry = Entry.new(name: params[:name]) end def create @entry = Entry.new(entry_params) if @entry.save redirect_to @entry, notice: 'Entry was successfully created.' else render :new end end
EX: Entry model has entry_type:string, so --> domain.com/entries/new?name=test
How do I include entry_params and (name: params[:name]) in the create action?
What does your form look like? Are you using form_for ? <%= form_for(@entry) do |f| %>
if so then you should be able to do this: @entry = Entry.new( params[:entry])