don't try to add data to new models

This commit is contained in:
John Bintz 2012-12-23 13:05:11 -05:00
parent 8b98a0b4c6
commit 517c7d6937
1 changed files with 6 additions and 1 deletions

View File

@ -52,7 +52,12 @@ module SemanticRailsViewHelpers
route = model
route = route.to_route if route.respond_to?(:to_route)
link_to label, polymorphic_url(route, :action => action), options.merge(semantic_action_data(target_action).merge(semantic_model_data(model)))
data = semantic_action_data(target_action)
if action != :new
data.merge!(semantic_model_data(model))
end
link_to label, polymorphic_url(route, :action => action), options.merge(data)
end
def li_for(object, options = {}, &block)