Ruby on Rails Monday, July 6, 2015

I'm currently in the process of completing the setup for the
acts_as_follower gem for Rails 4. When I click on the follow button, the
ActionView Exception Missing Template kicks in. Does anyone know how to
create a multi-state Zurb Foundation button for it or even custom radius
button. Simply: "Follow/Unfollow" If you have a better approach, please
share it. These solutions are necessities to development.

https://github.com/tcocca/acts_as_follower

Missing template users/follow, application/follow with {:locale=>[:en],
:formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw,
:ruby, :coffee, :slim, :haml, :jbuilder]}. Searched in:

<%= link_to 'Follow', follow_user_path(@user), class: 'button success
radius small' %>

def follow
@user = User.friendly.find(params[:id])
if current_user
if current_user == @user
flash[:error] = 'You cannot follow yourself.'
else
current_user.follow(@user)
flash[:notice] = "You are now following #{@user.username}"
end
else
flash[:error] = "You must be logged in to follow
#{@user.username}."
redirect_to :back
end
end

def unfollow
@user = User.friendly.find(params[:id])
if current_user
current_user.stop_following(@user)
flash[:notice] = "You are no longer following #{@user.username}."
else
flash[:error] = "You must be logged in to unfollow
#{@user.username}."
redirect_to user_path(@user)
end
end

def block
@user = User.friendly.find(params[:id])
if current_user
current_user.block(@user)
flash[:notice] = "You have blocked #{@user.username}."
redirect_to user_path(@user)
else
flash[:notice] = "You aren't following #{@user.username}."
end
end

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/48707e8971eed2b0ac24a5bb054b3a9b%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment