Skip to content

Instantly share code, notes, and snippets.

## app/assets/javascripts/tenon/controllers/product_updates.js.coffee
Tenon.dispatcher.route 'tenon/product_updates#index', ->
new Tenon.features.AdvancedSearch
## app/controllers/tenon/product_updates_controller.rb
before_filter :initialize_advanced_search_params, only: :index
def index
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: postgresql #changed this
encoding: utf8
database: hosted_development #changed this
username: alan #changed this
password: MlwhvC4R
# Warning: The database defined as "test" will be erased and
# This creates Review model, controller, columns, and indexed movie_id column, and a one-to-many relationship between reviews movies.
rails g resource Review name:string stars:integer comment:text movie:references --no-test-framework
@HammerInTheNews
HammerInTheNews / form_for
Last active August 29, 2015 14:14
Add error message handling
# Put this in the form_for loop after "do"
<%= render 'shared/errors', object: @object_name %>
# Then in the shared/errors partial put:
<% if object.errors.any? %>
<section id="errors">
<header>
<h2>
Oops! The <%= object.titleize.downcase %> could not be saved.
</h2>