Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


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