Home undefined method `image' for #<Post:0x007f6018a697b0>
Reply: 0

undefined method `image' for #<Post:0x007f6018a697b0>

user792
1#
user792 Published in July 20, 2018, 1:09 am

I get this error in my porject :

undefined method `image' for #

this is my code : 
= simple_form_for @post do |f|
  = f.input :image
  = f.input :caption
  = f.button :submit

this is my model post.rb

class Post < ApplicationRecord
    class Post < ActiveRecord::Base
        validates :image, presence: true

        has_attached_file :image, styles: { :medium => "640x" }
        validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/
    end
end

this is my controller post_controller.rb

class PostsController < ApplicationController
    def index
    end

    def new
        @post = Post.new
    end
end
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.301013 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO