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 Plan < ActiveRecord::Base | |
has_many :plan_additions | |
... | |
after_validation do | |
plan_additions.each do |plan_addition| | |
# hier könnte eine andere, bessere Validierung in plan_addition model gepackt werden | |
if plan_addition.monthly_price.blank? | |
plan_addition.errors.add(:monthly_price, :blank) |
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 Plan < ActiveRecord::Base | |
... | |
has_many :plan_additions, :inverse_of => :plan | |
validates_associated :plan_additions | |
accepts_nested_attributes_for :plan_additions | |
... |
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
begin | |
# something which might raise an exception | |
rescue SomeExceptionClass => some_variable | |
# code that deals with some exception | |
rescue SomeOtherException => some_other_variable | |
# code that deals with some other exception | |
else | |
# code that runs only if *no* exception was raised | |
ensure | |
# ensure that this code always runs, no matter what |
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
# insert JRUBY_OPTS in | |
# /home/your_home_directory/.rvm/hooks/ | |
# in file "after_use_jruby" | |
JRUBY_OPTS="-J-Xmx1024m -J-XX:MaxPermSize=512m " ; export JRUBY_OPTS |
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
$(document).ready(function () { | |
// click event-listener for discounted link | |
$('#marketing-discounted-link').click(function(){ | |
// data from data attributes | |
var data = $('#marketing-discounted-data').data(); | |
var url = $(this).attr('href'); | |
var dynForm = buildForm(data, url); | |
dynForm.submit(); |