This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"channels": { | |
"78": { | |
"name": "Zombie Bass", | |
"num_of_listeners": 1, | |
"created_at": "2012-03-21T04:04:36Z", | |
"updated_at": "2012-04-20T01:21:12Z" | |
}, | |
"82": { | |
"name": "The Beatles123", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"channels": [ | |
{ | |
"number": 78, | |
"name": "Zombie Bass", | |
"num_of_listeners": 1, | |
"created_at": "2012-03-21T04:04:36Z", | |
"updated_at": "2012-04-20T01:21:12Z" | |
}, | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"channels": [ | |
{ | |
"number": 78, | |
"name": "Zombie Bass", | |
"num_of_listeners": 1, | |
"created_at": "2012-03-21T04:04:36Z", | |
"updated_at": "2012-04-20T01:21:12Z" | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RKObjectMapping* channelMapping = [RKObjectMapping mappingForClass:[Channel class]]; | |
[channelMapping mapKeyPath:@"id" toAttribute:@"identifier"]; | |
[channelMapping mapKeyPath:@"name" toAttribute:@"name"]; | |
[channelMapping mapKeyPath:@"num_of_listeners" toAttribute:@"numOfListeners"]; | |
//object mapping for GETs | |
[[RKObjectManager sharedManager].mappingProvider setMapping:channelMapping forKeyPath:@"channels"]; | |
//set up object serialization for POSTing back to rails | |
RKObjectMapping* channelSerializationMapping = [channelMapping inverseMapping]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"channels": { | |
"channel_78": { | |
"name": "Zombie Bass", | |
"num_of_listeners": 1, | |
"created_at": "2012-03-21T04:04:36Z", | |
"updated_at": "2012-04-20T01:21:12Z" | |
}, | |
"channel_82": { | |
"name": "The Beatles123", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)setupObjectMapping { | |
// RKObjectMapping* channelMapping = [RKObjectMapping mappingForClass:[Channel class]]; | |
// [channelMapping mapKeyPath:@"id" toAttribute:@"identifier"]; | |
// [channelMapping mapKeyPath:@"name" toAttribute:@"name"]; | |
// //[channelMapping mapKeyPath:@"created_at" toAttribute:@"createdAt"]; | |
// //[channelMapping mapKeyPath:@"updated_at" toAttribute:@"updatedAt"]; | |
// [channelMapping mapKeyPath:@"num_of_listeners" toAttribute:@"numOfListeners"]; | |
RKObjectMapping* channelMapping = [RKObjectMapping mappingForClass:[Channel class] ]; | |
channelMapping.forceCollectionMapping = YES; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteCond %{HTTP_HOST} ^store.site.com [OR] | |
RewriteCond %{HTTP_HOST} ^www.store.site.com | |
RewriteRule ^(.*)$ http://site.com [R=301,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
class PostTest < ActiveSupport::TestCase | |
test "the truth" do | |
assert_equal true, true | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Authentication Load (0.2ms) SELECT `authentications`.* FROM `authentications` WHERE `authentications`.`user_id` = 17 LIMIT 1 | |
(0.4ms) SELECT ig_id FROM `comments` WHERE `comments`.`post_id` = 1443 | |
User Load (0.3ms) SELECT `users`.* FROM `users` LIMIT 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#post_test.rb | |
should "add points to post.user when updating title" do | |
@user = FactoryGirl.create(:user) | |
@post = FactoryGirl.create(:post, :title => nil, :story => nil, :user_id => @user.id) | |
pts_before = @user.points | |
@post.update_attributes(:title => "new title") | |
pts_after = @user.points | |
assert_not_equal(pts_before, pts_after) | |
#user's points == 10 here, even though it JUST showed 12 inside the post#add_points method | |
end |