I'm pretty new to rails and I'd like to set my links for a certain page dynamically. I have a table called "Unfinished" and it has a column called "link" (corrected from "links") I'd like to be able to call the "link" record in the view to set my link_to link path.
I am trying to do this...
<%= link_to @unfinished.link(:p => @post.id) do %> FINISH <% end %>
...but that's not working.
my controller says:
def show
@post = Post.find(params[:id])
@unfinished = Unfinished.where('progress = ?', @post.progress).last
end
and the controller logic works fine...until I try to put the @unfinished.link into link_to
Edit: Error Message:
wrong number of arguments (1 for 0)
Model
class Unfinished < ActiveRecord::Base
end
The type of links are :
step1_path
step2_path
step3_path
I am making a multipage form that you can save partway through. Based on a value in the @post.progress column (like 1, 2, 3) the correct path to complete the post will be provided (step1_path, step2_path etc...)