Skip to content

Instantly share code, notes, and snippets.

ActiveRecord::AssociationTypeMismatch in UsersController#update
Photo(#2175010700) expected, got HashWithIndifferentAccess(#2158250880)
RAILS_ROOT: /Users/felixflores86/Sites/veritas
Application Trace | Framework Trace | Full Trace
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/associations/association_proxy.rb:263:in `raise_on_type_mismatch'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/associations/has_one_association.rb:52:in `replace'
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/associations.rb:1278:in `photo='
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:2744:in `send'
Feature: User profiles
In order to have users profiles
for the website
I want to be able to view and edit users
Background: Set up user
Scenario: Edit profile
Given a user is logged in as "foobar@example.com"
Feature: Managing movies
In order manage movies
As an authorized user
I want to be able to manage movies
Background: Only authenticated users can add movies
Given a user is logged in as "foobar@example.com"
Given /^a user is logged in as "(.*)"$/ do |email|
named_scope :coming_soon,
:joins => :showtimes,
:having => 'showtimes.day > CURRENT_DATE'
# WHAT!!!!
(rdb:27) @movies_for_the_week[1][:items].size
2
(rdb:27) @movies_for_the_week[1][:items]
[]
(rdb:27) @movies_for_the_week[1][:items].size
0
>> m = Movie.for_the_week
class MoviesController < ApplicationController
def index
if params[:filter] == "coming_soon"
@movies = Movie.coming_soon
else
@movies_for_the_week = Movie.for_the_week
end
@view = params[:filter]
end
// Assuming you have underscore and jQuery as a project dependency.
// You can use this to include individual files on your jasmine specs.
// Sample Usage
requireJS('myJSfile', 'myOtherJsFile');
describe("My stuff", function() {
it("rocks", function() {
// your spec
@felixflores
felixflores / UIViewController+Segue.h
Last active December 9, 2015 22:08
A convenient category to make segue preparation a little nicer.
//
// UIViewController+Segue.h
// TimeCapsule
//
// Created by Felix Flores on 12/19/12.
// Copyright (c) 2012 felixflor.es. All rights reserved.
//
#import <UIKit/UIKit.h>
@felixflores
felixflores / UIViewController+ActionSheet.h
Last active December 10, 2015 00:48
Make Action Sheet a little bit more sane
//
// UIViewController+ActionSheet.h
// Tweaks
//
// Created by Felix Flores on 12/21/12.
// Copyright (c) 2012 felixflor.es. All rights reserved.
//
#import <UIKit/UIKit.h>
@felixflores
felixflores / gist:4508072
Last active December 10, 2015 23:18
Felix' Open Source Bio for the Neo Website. Please help me finish this.
Felix is software developer who likes to dabble in art, snowboarding
and often times finds himself in very unusual situations.