Created
February 9, 2011 08:55
-
-
Save cyberfox/818166 to your computer and use it in GitHub Desktop.
MacRuby example of using Core Data to search for Category objects
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
class AuctionTableDatasource | |
attr_writer :app_delegate | |
attr_accessor :view | |
. | |
. | |
. | |
def set_selected_category(category_name) | |
context = @app_delegate.managedObjectContext | |
@current_category = Category.find_first(context, by_name:category_name) | |
all = @current_category.auctions.allObjects | |
@all_rows = all.collect do |row| | |
# This converts the Core Data object into a hash that the rest of the data source uses to display. | |
translate_row(row) | |
end | |
view.reloadData | |
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
require 'entity' | |
class Category < Entity | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment