0

I am building a simple application with Padrino

I have set up a link to pass parameters as follows:

.new_update=button_to pat(:new_update), url(:updates, :new), :status_notice_id => @status_notice.id, :method => :get, :class => :button_to

Which is rendered as follows:

 <form class="button_to" action="/admin/updates/new" status_notice_id="2" method="get">

My admin controller looks like:

 get :new do 
      @status_notice_id = params[:status_notice_id]
      @update = Update.new :status_notice_id => @status_notice_id
      render 'updates/new'
    end

However I am at a loss as how to successfully pull the parameter into my code. Any ideas? I'm new to both sinatra and padrino, so I'm guessing I haven't gotten a handle on routing correctly but I'm getting increasingly confused.

1 Answers1

0

Use url(:updates, :new, :status_notice_id => @status_notice.id) to get /admin/updates/new?status_notice_id=2 URL.

In your code status_notice_id applies to button_to helper method and goes to html attributes.

ujifgc
  • 2,215
  • 2
  • 19
  • 21