Hi all,
Good day.
Can I add an additional ruby file to the model of my RhoMobile App?
For instance I have a model called Product and it has edit.erb, index.erb, new.erb, show.erb by default.
If I have additional view, like show location, can I create show_location.erb and put it to Product folder?
I have this search_box function at product_controller.rb, which contains the following code fragment:
def search_box
@product = Product.find(:all, :conditions =>{'box_id' => @params['box_id']})
#@product = Product.find(@params['box_id']);
@err_msg = ""
if @product
redirect :action => :show_location
else
@err_msg = "Box ID not found!"
render :action => :index
end
end
When i try to execute this code, i always get server internal error and show_location.erb was not able to rendered.
Please help.
Many thanks.
Regards,
Kelly
1 Replies
Sure, it should work.
While you would almost always have a controller method for it, and use render in that method, if you do not have a show_location controller method, it will just render the ERB with the matching file name.
Exactly what error message did you get?