I am not sure how to display tags in my view that belong to a user registered in Omniauth.
The page in the view loads random photos and tags associated with it (through a form that can be updated from this page). It works, but when I log in with Facebook A, it will show exactly the same tags as when logging in with Facebook.
Getting nil firmware with this below. The id for nil is called, which will be 4 by mistake - if you really need the nil identifier, use object_id
View:
<%= render 'tag_form' %>
Updated: Form:
<%= form_for @brand, :html => {:multipart => true} do |f| %> <%= f.error_messages %> <p> <%= f.label :tag_list, "Your tags" %> <%= f.text_field :tag_list, :value => @brand.all_tags_list %> </p> <p><%= f.submit "Tag" %></p> <% end %> # <%= f.text_field :tag_list %> was changed to the one above.
Tags are also called in the user dashboard, as shown below (currently empty, because obviously I canβt update tags right now):
<%= brand.taggings( :tagger_id => current_user.id, :tagger_type => 'User').collect{|tagging| tagging.tag.to_s}.join(", ") %>
Application controller displaying current user
def current_user @current_user ||= User.find(session[:user_id]) if session[:user_id] end
Brand controller
helper_method :current_user def index @brands = Brand.all @brand = Brand.order("RANDOM()").first end
Added: Brand Model
attr_accessible :name, :tag_list, :current_user acts_as_taggable_on :tags belongs_to :user before_save :set_tag_owner def set_tag_owner set_owner_tag_list_on(@brand, :tags, self.tag_list) self.tag_list = nil end
ruby-on-rails ruby-on-rails-3 tagging omniauth acts-as-taggable-on
Simpleton
source share