ruby on rails 3 - yet another undefined method `model_name' for Project:Class -
i new rails , trying creating simple client youtube. using youtube_it gem retrieve videos in 1 of playlists , using code:
controller:
class playlistscontroller < applicationcontroller def show client = session[:client] @playlist = client.playlist(params[:id]) @playlist.extend(baseplaylist) end end
module extend youtube_it/playlist.class:
module baseplaylist extend activemodel::naming include activemodel::conversion def model_name 'playlist' end def persisted? false end end
playlists/show.html.erb:
<h1><%= @playlist.title %></h1> <%= render 'form' %>
playlists/_form.html.erb:
<%= form_for(@playlist) |f| %> <% @playlist.videos.each |video| %> <div class="field"> <%= f.check_box_tag video.title %> <%= f.label video.title %> </div> <% end %> <div class="actions"> <%= f.submit %> </div> <% end %>
what getting is:
undefined method `model_name' youtubeit::model::playlist:class
what did above trying "wrap" playlist object doesn't work. idea?
while have defined module adds methods want, none of code in question shows how module added playlist class. i'm not familiar youtubeit gem can't sure how you'd that, if example wanted add module built-in string class you'd this:
class string include baseplaylist end
Comments
Post a Comment