Problems after scaffold

Please some help!!!
I made a scaffold the search, then i added a new method called
printimages
in the search controller and a view for the same but then i want to
access
throw the browser to this method searchs/printimages
and it throws me that cant find the id. Somebody knows what is the
problem?
the same happends when i do a link_to :action the name of the method in
the
controller.

Thank you!

Felipe V. Contesse
Ingeniería Civil Industrial UC

On Fri, Aug 8, 2008 at 3:45 AM, Felipe V. [email protected]
wrote:

Please some help!!!
I made a scaffold the search, then i added a new method called printimages
in the search controller and a view for the same but then i want to access
throw the browser to this method searchs/printimages
and it throws me that cant find the id. Somebody knows what is the problem?
the same happends when i do a link_to :action the name of the method in the
controller.

Can you show the code for printimages and the link in the
view that points to it?

What version of rails are you using? If you are using 2.0 or later
then the scaffold command created a RESTful controller for you. That
controller is “prewired” to recognize index, show, edit, update, new,
create, and destroy. For actions with other names you’ll have to
modify routes.rb.

The modification to make in routes.rb will depend on what the
printimages action needs to do. The controller (search) sounds like
it is responsible for managing many different kinds of objects rather
than one particular object so you probably want to add ‘printimages’
as a collection option (ie., it requires no id). That would look
something like this in your routes.rb

map.resources :search, :collection=>{:printimages=>:put}

When you specify a collection action (or a :member action when you
have one particular object in mind) you provide a hash whose keys are
the names of the actions and whose values are the HTTP verbs that are
permitted to access that action. If you specify anything other
than :get or :post you will have to do a little extra work when
specifying the url for a link.

Check out the ActionController::Resources api for more info.

HTH,
AndyV

I will try that thank you very much!

Felipe V. Contesse
Ingeniería Civil Industrial UC

It worked thankyou very much!!!


Felipe V. Contesse
Ingeniería Civil Industrial UC

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs