Hi all, I've the following doubt.
I've this controller methods:
def set_elaborator
@entry = Entry.find(params[:id])
@entry.geomatics_elaboration_id = current_user.id
if @entry.save!
redirect_to(@entry, :notice => 'Elaborator setted successfully')
end
end
def set_reviewer
@entry = Entry.find(params[:id])
@entry.geomatics_checker_id = current_user.id
if @entry.save!
redirect_to(@entry, :notice => 'Elaborator setted successfully')
end
end
So, I want to add a link in the show view, like this:
<p>
<b><%= t('entries.fields.geomatics_elaboration') %>:</b>
<% if @entry.geomatics_elaboration_id.nil? and current_user.geomatics %>
<%= link_to entry, :confirm => 'Are you sure?', :method =>
:set_elaborator do %>
<img src="../images/buttons/Delete.png" title="Elaborate this
entry"/>
<% end %>
<% elsif @entry.geomatics_elaboration_id.nil? and not
current_user.geomatics %>
<%= t('entries.messages.not_assigned_yet') %>
<% else %>
<%= User.find(@entry.geomatics_elaboration_id).fullname %>
<% end %>
</p>
<p>
<b><%= t('entries.fields.geomatics_review') %>:</b>
<% if @entry.geomatics_checker_id.nil? and current_user.geomatics %>
<%= link_to @entry, :confirm => 'Are you sure?', :method =>
:set_reviewer do %>
<img src="../images/buttons/Delete.png" title="Review this entry"/>
<% end %>
<% elsif @entry.geomatics_checker_id.nil? and not current_user.geomatics
%>
<%= t('entries.messages.not_assigned_yet') %>
<% else %>
<%= User.find(@entry.geomatics_checker_id).fullname %>
<% end %>
</p>
I want to, when I click the link update the @entry and load the show
template with the changes...
Any suggestion?
Regards,
--
TSU. Amador Cuenca
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.