Skip to content

Instantly share code, notes, and snippets.

@cyberfox
Created February 9, 2011 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cyberfox/818166 to your computer and use it in GitHub Desktop.
Save cyberfox/818166 to your computer and use it in GitHub Desktop.
MacRuby example of using Core Data to search for Category objects
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
require 'entity'
class Category < Entity
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment