Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Jon Moss
Jon Moss
1,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]) 
def create
    @entry = Entry.new(entry_params)
      if @entry.save
        redirect_to @entry, notice: 'Entry was successfully created.'
       render :new

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?

Kenan Memis
Kenan Memis
47,314 Points


You are saying you're model has an attribute entry_type:string but I did not understand what do you want to do with :name?

Could you be more specific about the name parameter? What do you exactly want to do with it?

1 Answer

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])