Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError in OffersController#create uninitialized constant Offer::OfferTranslation #11

Open
wolfgangihloff opened this issue Jan 3, 2012 · 1 comment

Comments

@wolfgangihloff
Copy link

I see the following error, when I submit a new offer:

NameError in OffersController#create
uninitialized constant Offer::OfferTranslation
Rails.root: /Users/wolfgang/RubymineProjects/wasaabi
Application Trace | Framework Trace | Full Trace

app/controllers/offers_controller.rb:49:in `create'

My model

class Offer < ActiveRecord::Base
  attr_accessible :title, :content, :valid_from, :valid_to, :base_price, :base_currency
  belongs_to :user
  has_many :orders
  puret :title
  #, :description, :location, :city, :costs_include

  default_scope :order => 'offers.created_at DESC'
end

I tried commenting out some of the elements, where or how does the element get initialized? Do I have to provide data for the translation on create?

I am on ruby 1.9.2p290, Rails 3.1.3

@wolfgangihloff
Copy link
Author

So my changes included:

  • Renaming model file to offer_translation.rb
  • create_table(:post_translations) <-- adding parentheses
  • db drop and migrate
  • adding I18n to controller to: I18n.locale = params[:locale] before interactions with model
    Running the generator proved to be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant