I am trying to create a photo upload function for a website, and there are two ways to upload. One is by specifying a remote url link, another is by uploading from local computer. So this requires me to write two partials. What's an efficient way to create a photo_upload view with two links to the two situations above, using the same controller for photo? I am stuck on how to pass the redirection information to the controller. Ideally I want to set a photocontroller variable called upload_source when I click on one of the links, but I don't know how to use link_to to pass such variable and where would be the best place to define this boolean variable.
Some code examples:
from the view:
<h2>Upload a Photo: Step 1 of 3</h2>
<br>
<h3><strong>Where is your photo?</strong></h3>
<br>
<div class="button_border">
<a href="add_photo_web">On the Web</a>
</div>
<div class="button_border">
<%= link_to "On My Computer", new_photo_path%>
</div>
</div>
From photoController (not sure if this is the right thing to do):
helper_method :get_source, :set_source
private
def set_source=(_source)
@@source = _source
end
def get_source
@@source
end
Helps are greatly appreciated!
Thank you all for very generous help! I am constantly amazed by the efficiency of stackoverflow.