3

J'essaie d'utiliser le plugin paperclip dans mon application rails pour télécharger des images pour les messages. J'utilise Rails 2.0.2 et ruby ​​1.8.7 sur Ubuntu 10.04 os pour des projets spécifiques.Méthode non définie `has_attached_file 'avec trombone 2.3.8 gem pour Rails 2 en utilisant Ruby 1.8.7

Je fais référence aux tutoriels suivants pour cela: -

  1. http://railscasts.com/episodes/134-paperclip?view=comments

  2. http://jimneath.org/2008/04/17/paperclip-attaching-files-in-rails.html

J'ai fait un clone git sur le plugin paperclip via: - https://github.com/thoughtbot/paperclip, mais la commande comme ruby script/generate paperclip group_post photo n'a pas généré de migration pour cela. J'ai ensuite créé une migration pour le même à travers le script ruby ​​/ générer et téléchargé les colonnes appropriées de ma table group_posts. J'ai ensuite essayé d'installer la gemme et comme j'utilise activerecord et activeupport 2.0.2, j'ai utilisé paperclip 2.3.8 gem de rubygems.org. L'erreur de méthode indéfinie persistait, je n'arrivais vraiment pas à comprendre pourquoi.

Maintenant, ici, la commande ruby script/generate paperclip group_post photo a parfaitement fonctionné pour moi.

L'erreur actuelle, je reçois ressemble exactement comme ceci: -

undefined method `has_attached_file' for #<Class:0xb67119f0> 

Une chose drôle que j'ai observé wrt ce comportement était quand je servais de la CISR, require 'paperclip' retourné true mais je me demande pourquoi ils peuvent » t détecter la méthode qui vient avec l'application plugin dans mes rails.

La application Trace pour le même est: -

/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-2.0.2/lib/active_record/base.rb:1532:in `method_missing_without_paginate' 
vendor/plugins/will_paginate/lib/will_paginate/finder.rb:170:in `method_missing' 
app/models/group_post.rb:9 
app/controllers/groups_controller.rb:27:in `show' 

La trace complète pour ce juste au cas est: -

/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-2.0.2/lib/active_record/base.rb:1532:in `method_missing_without_paginate' 
vendor/plugins/will_paginate/lib/will_paginate/finder.rb:170:in `method_missing' 
app/models/group_post.rb:9 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:203:in `load_without_new_constant_marking' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:203:in `load_file' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:202:in `load_file' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:94:in `require_or_load' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:248:in `load_missing_constant' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:453:in `const_missing_not_from_s3_library' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:465:in `const_missing' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:471:in `send' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:471:in `const_missing' 
app/controllers/groups_controller.rb:27:in `show' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `send' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `perform_action_without_filters' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in `call_filters' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in `perform_action_without_benchmark' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue' 
/home/mohnish/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/benchmark.rb:293:in `measure' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in `perform_action_without_caching' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in `perform_action' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in `perform_action' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `send' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `process_without_filters' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in `process_without_session_management_support' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in `process_without_test' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/test_process.rb:15:in `process' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in `process' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in `handle_request' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in `process' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `synchronize' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `process' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in `run' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `each' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `run' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/bin/mongrel_rails:281 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.0.2/lib/commands/servers/mongrel.rb:64 
/home/mohnish/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
/home/mohnish/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require' 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.0.2/lib/commands/server.rb:39 
/home/mohnish/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
/home/mohnish/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
script/server:3 

Mon groups_controller.méthode show rb ressemble à ceci, voici la ligne 27 est @group_post = GroupPost.new(params[:group_post]): -

def show 
    @investor_group = InvestorGroup.find(params[:id]) 
    @members = @investor_group.activated_members 
    # code taken from discuss method 
    investor_id = session['investor_id'] 
    @investor = Investor.find(investor_id) 

    @members = @investor_group.activated_members 

    unless @current_user.is_an_existing_member_of_group(@investor_group) 
     flash[:notice] = "Please join this group to participate in discussions" 
     redirect_to :action => :show, :id => @investor_group and return 
    else 
     @group_post = GroupPost.new(params[:group_post]) # line 27, tried GroupPost.create also.. seems to be of no avail.. 
    end 
    #@group_post = GroupPost.new(params[:group_post]) 
     @group_post.investor_group_id = @investor_group.id 
     @group_post.post_by = investor_id 
    unless @group_post.message.blank? 
     if @group_post.save 
     flash[:notice] = 'Post was successfull' 
    else 
     flash[:notice] = 'Post was not successfull' 
     end 
     #redirect_to :action => :show, :id => @investor_group and return to change.. appropriately.... 
    end 
    #if @group_post.message.blank? 
    # flash[:notice] = 'Post can\'t be blank.' 
    #end 
    @group_all_posts = GroupPost.find(:all, :conditions => [ 'investor_group_id = ?', "#{@investor_group.id}" ], :order => 'created_at DESC') 
    # code taken from discuss method 
    end 

Le modèle group_post ressemble à ceci avec la ligne 9 ayant le code suivant has_attached_file: photo: -

classe GroupPost < ActiveRecord :: Base has_many: group_comments belongs_to: investor_group validates_presence_of: Message

#include Paperclip exigent "paperclip" # Paperclip has_attached_file: photo # ligne 9

fin

Une partie de mon dossier de vue où je suis en train de télécharger l'image avec un poste ressemble à ceci: -

<%form_for :group_post, @group_post, :url => {:action => :show},:html => {:multipart => 'true'},:id => 'new_post' do |f| -%> 
    <p><label>Start Discussion:</label><br><%=f.text_field :message%></p> 
    <%=f.file_field :photo%></p> 
    <p><%=submit_tag "Post"%></p> 
    <%end%> 

J'ai essayé ce qui a été donné en: -

Cette option ne semble pas applicable à mon cas car il semble utiliser une version supérieure Rails

J'ai essayé le comprennent Paperclip - mais il ne semblait pas vraiment aider mon cas ...

J'ai ajouté un besoin dans mon group_post.rb et dans mon Le fichier environment.rb nécessite "paperclip". Je reçois toujours une erreur de méthode non définie. Je ne sais pas pourquoi ..

En se référant à ce que j'ai essayé la fourche Imumar de paperclip, je coller le texte manuellement dans mon répertoire fournisseur/plugins après le clonage git it .. Je suis l'erreur suivante (j'ai le sentiment qu'il aurait sûrement été un problème de dépendance que sa version peut être compatible qu'avec une version de rails supérieur:

[email protected]:~/UP/dev$ ruby script/server -p 4000 
=> Booting Mongrel (use 'script/server webrick' to force WEBrick) 
=> Rails application starting on http://0.0.0.0:4000 
=> Call with -d to detach 
=> Ctrl-C to shutdown server 
** Starting Mongrel listening at 0.0.0.0:4000 
** Starting Rails with development environment... 
Exiting 
/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:263:in `load_missing_constant': uninitialized constant Paperclip::CallbackCompatability::Rails20 (NameError) 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:453:in `const_missing' 
    from /home/mohnish/UP/dev/vendor/plugins/paperclip/lib/paperclip.rb:118:in `included' 
    from /home/mohnish/UP/dev/vendor/plugins/paperclip/lib/paperclip.rb:364:in `include' 
    from /home/mohnish/UP/dev/vendor/plugins/paperclip/lib/paperclip.rb:364:in `send' 
    from /home/mohnish/UP/dev/vendor/plugins/paperclip/lib/paperclip.rb:364 
    from /home/mohnish/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
    from /home/mohnish/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require' 
    from /home/mohnish/UP/dev/vendor/plugins/paperclip/init.rb:1:in `evaluate_init_rb' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.0.2/lib/rails/plugin.rb:79:in `evaluate_init_rb' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.0.2/lib/rails/plugin.rb:75:in `evaluate_init_rb' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.0.2/lib/rails/plugin.rb:39:in `load' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.0.2/lib/rails/plugin/loader.rb:33:in `load_plugins' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.0.2/lib/rails/plugin/loader.rb:32:in `each' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.0.2/lib/rails/plugin/loader.rb:32:in `load_plugins' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.0.2/lib/initializer.rb:189:in `load_plugins' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.0.2/lib/initializer.rb:105:in `process' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.0.2/lib/initializer.rb:49:in `send' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.0.2/lib/initializer.rb:49:in `run' 
    from /home/mohnish/UP/dev/config/environment.rb:16 
    from /home/mohnish/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
    from /home/mohnish/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:147:in `rails' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/bin/mongrel_rails:113:in `cloaker_' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:149:in `call' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:149:in `listener' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/bin/mongrel_rails:99:in `cloaker_' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:50:in `call' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:50:in `initialize' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `new' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `run' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/mongrel-1.1.5/bin/mongrel_rails:281 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.0.2/lib/commands/servers/mongrel.rb:64 
    from /home/mohnish/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
    from /home/mohnish/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require' 
    from /home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.0.2/lib/commands/server.rb:39 
    from /home/mohnish/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
    from /home/mohnish/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
    from script/server:3 
[email protected]:~/UP/dev$ 

Je me demande vraiment où je me trompe ..

Toutes les suggestions/idées seraient très appréciées. Ce qui est urgent pour moi que j'ai un déploiement en raison, je serais vraiment heureux d'obtenir des réponses rapides/réponses ..

Merci beaucoup ..

Répondre

3

Ok, d'une part, juste pour couvrir la base « évidente » : faites "ls vendor/plugins" juste pour vous assurer qu'une version de paperclip est bien dans votre répertoire plugins et donc accessible par votre application.

Deuxièmement - le "trombone nécessaire" dans le modèle me semble faux. Je suppose que cela devrait aller dans votre environnement à la place. Essayez de le placer à la fin de config/environments.rb à la place. Troisièmement (et peut-être sans rapport avec votre problème spécifique) - 2.0.2 est une version très ancienne des rails. Si vous le pouvez, je passerais à la version 2.3.5 ou, à tout le moins, 2.2.x. Pour tout ce que nous savons - vous pourriez avoir un problème parce que vous avez une nouvelle version de trombone et une ancienne version de rails ... cela fait parfois une différence. Un grand nombre d'autres liens que vous avez postés se réfèrent à des installations jusqu'à Rails3 - les solutions à leurs problèmes seront différentes des vôtres pour cette raison.

+1

- Votre joli droit .. "vous avez une nouvelle version de trombone et une ancienne version de rails ..." est ce qui était mon problème exact .. pour le réparer, j'ai dû utiliser un plugin trombone de 8may08 commettre de github..got ce fixe .. environ une semaine de retour en fait ... posté une question similaire où j'ai obtenu une réponse/solution similaire à la vôtre .. Merci ... :) – boddhisattva

+0

Aucun problème. Heureux que vous l'ayez trié par la suite :) –

11

Légèrement liée, a décidé de mettre cela ici pour les futurs googlers. Utilisation de Rails 2.3.14 sur Ruby 1.8.7 avec bundler. Comme l'a suggéré thoughtbot J'utilise 2,7 paperclip, à savoir mon Gemfile contient:

gem "paperclip", "~> 2.7.0" 

je recevais aussi l'erreur « méthode non définie ». Ce qu'il fixe pour moi était de déposer un fichier dans paperclip.rbconfig/initializers contenant les éléments suivants:

require "paperclip/railtie" 
Paperclip::Railtie.insert 

Espérons que cela permettra d'économiser quelqu'un un peu de maux de tête.

+1

corrige ce problème pour moi, j'utilise rails 3.2.11 et trombone 3.4.0 –

+0

génial, merci pour votre poste – kasperite

+0

fixé mes malheurs aussi, sur l'ancien projet Rails 2.3.18 avec Paperclip 2.7 .5 – natebeaty

Questions connexes