# instead of doing in one step with create! do it in two steps with new, if (save) http://www.youtube.com/watch?v=iH3TMiRi7as logger.info params $ bundle exec rake assets:precompile Heroku logs heroku logs -n 1500 OR, to tail the logs live heroku logs -t To use a class vaiable @@ you need to define a getter for it class Movie < ActiveRecord::Base @@ALL_RATINGS = ['G','PG','PG-13','R','NC-17'] def self.ALL_RATINGS @@ALL_RATINGS end end
It isn't the prettiest, but it will work. However, I recommend keeping it to a single method call and defining it in the model.
Remain Restful!
If you get could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?
For associations: in migration: t.belongs_to :customer in model none in controller... instead of create! use new-save and for update_attributes! use update_attributes and check for validations and render relevant action. Display errors there = form_tag store_path(@store), :method => :put do - if @store.errors.any? %div#validation_error %b Errors %ul -@store.errors.full_messages.each do |e| %li = e = label :store, :name, 'Name' = text_field :store, 'name' = label :store, :address, 'Address' = text_field :store, 'address' = label :store, :description, 'Description' = text_area :store, 'description' = submit_tag 'Save Changes' heroku run rake db:schema:load # reload the whole schema |