Loading...
i was refactoring our Item model, where we have 3 has_many with 3 mapping models.
as we are not using InnoDB based foreign key constraint, we were searching some sort of reliable solution,
which will take pressure in application layer instead of leaving it to the database.
so later we introduced “:dependent” with has_may relation. here is our top of Item model.
has_many :category_mappings, :dependent => :destroy
has_many :categories, :through => :category_mappings
has_many :property_values, :dependent => :destroy
has_many :properties, :through => :property_value
has_many :item_location_mappings, :dependent => :destroy
has_many :locations, :through => :item_location_mappings
our “dependent” flagship is destroying all related items in the item destroy process which has introduced
our flexibility and reduced a lot of code to manage such stuff in a DRY(ied) manner.
so the following unit test worked fine for us.
some bad side,
dependent delete each and every item one by one, which is big issue when you have a big chunk of dependent data.
but that is not suppose to be common in every context. we have no problem with this issue.
best of luck!
“work for fun”
Here is open search specification - http://www.opensearch.org/Specifications/OpenSearch/1.1
Let’s enable your browser to detect your search engine automatically; using open search servlet you can generate open search configuration file on the fly.
Download information is here -
Binary war file (includes example usages)
Usages:
< servlet >
< servlet-name >openSearch< /servlet-name >
< servlet-class >com.we4tech.openSearch.servlet.OpenSearchServlet< /servlet-class >
< !-- URL matching pattern -- >
< init-param >
< param-name >url-match< /param-name >
< param-value >.*/(.+).osd< /param-value >
< !--< param-value >.*/search/(.+)< /param-value >-- >
< /init-param >
< !-- map open search configuration with url -- >
< init-param >
< param-name >open-search< /param-name >
< param-value >open-search.properties< /param-value >
< /init-param >
< init-param >
< param-name >somewherein-blog< /param-name >
< param-value >somewherein-blog.properties< /param-value >
< /init-param >
< /servlet >
< servlet-mapping >
< servlet-name >openSearch< /servlet-name >
< !--< url-pattern >/search/*< /url-pattern >-- >
< url-pattern >*.osd< /url-pattern >
< /servlet-mapping >
# Default open-search. properties
shortName=colorful moment.
description=somewhere in blog
contact=hasan@somewherein.net
url.1=text/html,get,http://www.somewherein.net/blog/index.php?s={searchTerms}&submit=
image.1=16,16,image/x-icon,http://www.searchmash.com/favicon.ico
Sample usages on your web site can be found here –
http://www.opensearch.org/Specifications/OpenSearch/1.1#Autodiscovery_in_HTML.2FXHTML
Best wishes,







| www.flickr.com |
Leave a reply