ruby on rails - Undefined paperclip method -


i getting method undefined error in rails project. method used plugin paperclip. can tell me i'm doing wrong? here beginning of picture class:

require "paperclip"

class picture < activerecord::base    validates_attachment_content_type :photo, :content_type => ['image/jpeg', 'image/png', 'image/pjpeg', 'image/gif','image/bmp']   validates_attachment_presence :photo, :message => 'is required'    belongs_to :incident   belongs_to :user ... 

here's error:

extracted source (around line #122):  119: <%= link_to 'printable', { :action => 'print', :id => @incident.id }, { :target => '_blank', :class => "button" } %> 120: <% if isviewable?(@incident) %> 121:  122:   <%= link_to "pictures (#{@incident.pictures.count})", incident_pictures_path(@incident), :class => "button" %> 123:   <%= link_to "suspects (#{@incident.suspects.count})", incident_suspects_path(@incident), :class => "button" %>  application trace:  /usr/local/rvm/gems/ruby-1.8.7-p371/gems/activerecord-2.3.11/lib/active_record/base.rb:1998:in `method_missing' /users/grantmc/dev/railsprojects/police/app/models/picture.rb:5 /users/grantmc/dev/railsprojects/police/app/views/incidents/show.html.erb:122:in `_run_erb_app47views47incidents47show46html46erb' 

you missing attr_accessible in model.

paperclip have attribute not part of model, have explicitly asign attr_accessor them attr_accessor :attach


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -