Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7830847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:25:46+00:00 2026-06-02T11:25:46+00:00

Currently I have a model ‘Locations’ that has an image upload field added to

  • 0

Currently I have a model ‘Locations’ that has an image upload field added to the form. When I go, to lets say” update one the existing locations or even add a new one, it will upload the image correctly and display it, but will not save any of the input fields.

If I remove the upload photo field on the form and do not require it, then everything updates and saves correctly. So having an issue when a image is present, it saving the image but not the rest of the fields.

Any suggestions on why this might be happening?

Locations.rb

class Location < ActiveRecord::Base

  belongs_to :region
  has_many :spots


  validates_attachment_size :photo, :less_than => 5.megabytes
  validates_attachment_content_type :photo, :content_type => ['image/jpeg', 'image/png']

   has_attached_file :photo,
                :styles => { :thumb => "150x150#", :medium => "200x200#"},
                :path => ":attachment/:id/:style.:extension",
                :s3_domain_url => "adsimgstore.s3.amazonaws.com",
                :storage => :s3,
                :s3_credentials => Rails.root.join("config/s3.yml"),
                :bucket => 'adsimgstore',
                :s3_permissions => :public_read,
                :convert_options => { :all => "-auto-orient" }


   attr_accessible :locations, :photo, :photo_file_name, :photo_content_type, :photo_file_size,     :photo_updated_at
end

Form

<%= form_for (@location), :html => { :multipart => true } do |f| %>
  <% if @location.errors.any? %>
  <div id="error_explanation">
  <h2><%= pluralize(@location.errors.count, "error") %> prohibited this location from being saved:</h2>

  <ul>
  <% @location.errors.full_messages.each do |msg| %>
    <li><%= msg %></li>
  <% end %>
  </ul>
</div>
<div class="field">
  <%= f.label :name %><br />
  <%= f.text_field :name %>
</div>

<div class="field">
  <%= f.label :network_id %><br />
  <%= f.text_field :network_id %>
</div>

<div class="field">
  <%= f.label :region_id %><br />
  <%= f.text_field :region_id %>
</div>

<div class="field">
  <%= f.label :spot_duration %><br />
  <%= f.text_field :spot_duration %>
</div>

<div class="field">
  <%= f.label :frequency %><br />
 <%= f.text_field :frequency %>
</div>

<div class="field">
  <%= f.label :screen_count %><br />
  <%= f.text_field :screen_count %>
</div>

<div class="field">
  <%= f.label :ad_size %><br />
  <%= f.text_field :ad_size %>
</div>

<div class="field">
  <%= f.label :ad_type %><br />
  <%= f.text_field :ad_type %>
</div>

<div class="field">
  <%= f.label :impressions %><br />
  <%= f.text_field :impressions %>
</div>

<div class="field">
  <%= f.label :rate_card %><br />
  <%= f.text_field :rate_card %>
</div>

<div class="field">
  <%= f.file_field :photo %>
</div>

<div class="field">
  <td><%= image_tag @location.photo.url(:thumb) %></td>
</div>

<div class="actions">
  <%= f.submit %>
</div>
<% end %>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T11:25:50+00:00Added an answer on June 2, 2026 at 11:25 am

    Did you try to comment the line

       attr_accessible :locations, :photo, :photo_file_name, :photo_content_type, :photo_file_size,     :photo_updated_at
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a model that the user can upload a thumbnail to the
I currently have a client that wants me to 'abstract' out a domain model
I currently have a model that creates an array and returns it using the
I currently have a model Attend that will have a status column, and this
I currently have a data model set up where each School object has a
Currently I have an Model that's recursive (one of its properties is of the
I currently have an Entity Framework model that collects data from a legacy database
I currently have a Order and image model which look like this: class Order
I currently have a DetailView for Django's built-in User . url( r'^users/(?P<pk>\d+)/$', DetailView.as_view( model
Currently I have a DateTime property for a model. I am using the telerik

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.