• Home

  • Custom Ecommerce
  • Application Development
  • Database Consulting
  • Cloud Hosting
  • Systems Integration
  • Legacy Business Systems
  • Security & Compliance
  • GIS

  • Expertise

  • About Us
  • Our Team
  • Clients
  • Blog
  • Careers

  • VisionPort

  • Contact
  • Piggybak: An Update on End Point's Ruby on Rails Ecommerce Engine

    Steph Skardal

    By Steph Skardal
    September 24, 2012

    With the recent release of one of our client sites running on Piggybak, Piggybak saw quite a few iterations, both for bug fixes and new feature development. Here are a few updates to Piggybak since its announcement earlier this year.

    Admin: Continues to Leverage RailsAdmin

    Piggybak continues to leverage RailsAdmin. RailsAdmin is a customizable admin interface that automagically hooks into your application models. In the case of the recent project completion, the admin was customized to add new features and customize the appearance, which can be done in RailsAdmin with ease.

    As much as I enjoy working with RailsAdmin, I think it would be great in the future to expand the admin support to include other popular Rails admin tools such as ActiveAdmin, which has also gained popularity in the Rails space.

    Refund Adjustments

    When Piggybak first came out, there was little in the way to allow orders to be monetarily adjusted in the admin after an order was placed. One requirement that came out of client-driven development was the need for recording refund adjustments. A new model for “Adjustments” is now included in Piggybak. An arbitrary adjustment can be entered in the admin, …


    ecommerce piggybak rails

    Insidious List Context

    Jeff Boes

    By Jeff Boes
    September 20, 2012

    Recently, I fell into a deep pit. Not literally, but a deep pit of Perl debugging. As a result, I’m here to warn you and yours about “Insidious List Context(TM)”.

    (Note: this is a fairly elementary discussion, for people early in their Perl wizardry training.)

    Perl has two contexts for evaluating expressions: list and scalar. (All who know this stuff cold can skip down a ways.) “Scalar” context is what non-Perl languages just call “normal reality”, but Perl likes to do things … differently … so we have more than one context.

    In scalar context, a scalar is a scalar is a scalar, but a list becomes a scalar that represents the number of items in the list. Thus,

    @x = (1, 1, 1);  # @x is a list of three 1s
    # vs.
    $x = (1, 1, 1);  # $x is "3", the list size

    In list context, a list of things is still a list of things. That’s pretty simple, but when you are expecting a scalar and you get a list, your world can get pretty confused.

    Okay, now the know-it-alls have rejoined us. I had a Perl hashref being initialized with code something like this:

    my $hr = {
      KEY1 => $value1,
      KEY2 => $value2,
      KEY_TROUBLE => …

    interchange perl

    Rails 4 Highlights

    Steph Skardal

    By Steph Skardal
    September 20, 2012

    I watched this recent video What to Expect in Rails 4.0 presented by Prem Sichanugrist to the Boston Ruby Group. Here are a few high-level topics he covered in the talk:

    • StrongParameters: replaces attr_accessor, attr_protected, moves param filtering concern to the controller rather than the model. Moving param filtering concern to the controller allows you to more easily modify user attribute change-ability in controllers (e.g. customer-facing vs admin).
    • ActiveSupport::Queue: Discussed at RailsConf, add queueing support to Rails, e.g.:
    # Add to queue
    Rails.queue.push UserRegistrationMailerJob(@user.id)
    
    # Control queue configuration (asynchronous, synchronous or resque, e.g.
    config.queue = [:asynchronous, :synchronous, :resque]
    • Cache Digests: Rails 4.0 introduces cache key generation based on an item and its dependencies, so nested cache elements properly expire when an item is updated.

    • PATCH verb support: Support of HTTP PATCH method (_method equals “patch”), which will map to your update action is introduced in Rails 4.0.

    • Routing Concern: Rails 4.0 introduces some methods to help clean up your duplicate routes.

    • Improvements to ActiveRecord::Relation …


    ruby rails

    AJAX Queuing in Piggybak

    Steph Skardal

    By Steph Skardal
    September 18, 2012

    AJAX is inherently asynchronous; for the most part, this works fine in web development, but sometimes it can cause problem if you have multiple related AJAX calls that are asynchronous to eachother, such as the use case described in this article.

    In Piggybak, a Ruby on Rails open source shopping cart module developed and maintained by End Point, the one page checkout uses AJAX to generate shipping options. Whenever state and zip options change, the shipping address information is sent via AJAX and valid shipping methods are returned and rendered in a select dropdown.

    Event listeners on the state and zip code inputs trigger to generate shipping options via AJAX.

    While working on development for a client using Piggybak, I came across a scenario where AJAX asynchronous-ity was problematic. Here’s how the problematic behavior looked on a timeline, picking up as the user enters their shipping address:

    • 0 seconds: User changes state, triggers AJAX shipping lookup with state value, but no zip code entered (Let’s refer to this as AJAX REQUEST 1).
    • 1 second: User changes zip code, triggers AJAX shipping lookup with state and zip value present (Let’s refer to this as AJAX …

    javascript ecommerce jquery piggybak rails

    Company Presentation: Ecommerce as an Engine

    Steph Skardal

    By Steph Skardal
    September 14, 2012

    Today, I gave the presentation to my coworkers entitled “Puppies & Ecommerce as an Engine”. The presentation is strongly coupled with my work on Piggybak, and includes a discussion of traditional ecommerce platforms versus a lightweight ecommerce approach through modularity (Rails Engine). It also provides some code examples as how this does work in Piggybak.

    Below are a few more related articles to my work on Piggybak. Check them out!


    ecommerce piggybak rails spree company

    Three Things: Times Two

    Steph Skardal

    By Steph Skardal
    September 10, 2012

    It’s been a while since I’ve written up a “Three Things” article where I share a few featured web development tidbits picked up recently. So I made this a double episode!

    1. event.stopPropagation() and event.stopImmediatePropagation()

    I recently came across these two methods in jQuery, described here and here. Both of these methods [prevent the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event]. In my web application, my $(‘html’) element had a listener on it, but I added specific listeners to children elements that when clicked on calls event.stopPropagation to cancel the event on the $(‘html’) element. See the code below for a simplified example:

    jQuery(function() {
        jQuery('html').click(function() {
            jQuery.hideSomething();
        });
        jQuery('.popup').click(function(event) {
            event.stopPropagation();
        });
    })

    2. alias_attribute

    The alias method in Rails is one that I use frequently. But I recently came across the alias_attribute method as well. This might make the most sense to use when using shared views for multiple models with varying attributes.

    3. Excel behavior …


    jquery rails tips

    Cannot parse Cookie header in Ruby on Rails

    Steph Skardal

    By Steph Skardal
    September 7, 2012

    Yesterday I resolved a client emergency for a Ruby on Rails site that continues to leave me scratching my head, even with follow-up investigation. In short, the emergency came up after an email marketing campaign was sent out in the morning, and resulted in server (HTTP 500 Status Code) errors for every customer that clicked on the email links. Despite the fact that Rails exception emails are sent to the client and me, the errors were never reaching the exception email code, so I was unaware of the emergency until the client contacted me.

    Upon jumping on the server, I saw this in the production log repeatedly:

    ArgumentError (cannot parse Cookie header: invalid %-encoding (...)):
    ArgumentError (cannot parse Cookie header: invalid %-encoding (...)):
    ArgumentError (cannot parse Cookie header: invalid %-encoding (...)):

    The URLs that the production log was complaining about had a bunch of Google Analytics tracking variables:

    • utmcmd=Email
    • utmcct=customeremail
    • utmccn=New Site Sale 70% off
    • etc.

    After a user visits the site, these variables are typically stored as cookies for Google Analytics tracking. Upon initial investigation, the issue appeared to be triggered from any Google …


    analytics ecommerce piggybak rails

    Enforcing Transaction Compartments with Foreign Keys and SECURITY DEFINER

    Mark Johnson

    By Mark Johnson
    September 4, 2012

    In support of End Point’s evolving offering for multi-master database replication, from the precursor to Bucardo through several versions of Bucardo itself, our code solutions depended on the ability to suppress the actions of triggers and rules through direct manipulation of the pg_class table. Most PostgreSQL database developers are probably familiar with the construct we used from the DDL scripts generated by pg_dump at one time.

    Disable triggers and rules on table “public”.“foo”:

    UPDATE pg_class SET
            relhasrules = false,
            reltriggers = 0
        FROM pg_namespace
        WHERE pg_namespace.oid = pg_class.relnamespace
            AND pg_namespace.nspname = 'public'
            AND pg_class.relname = 'foo';

    Re-enable all triggers and rules on “public”.“foo” when finished with DML that must not fire triggers and rules:

    UPDATE pg_class SET
            reltriggers = (
                SELECT COUNT(*) FROM pg_trigger
                WHERE pg_class.oid = pg_trigger.tgrelid
            ),
            relhasrules = (
                SELECT COUNT(*) > 0
                FROM pg_rules
                WHERE schemaname = 'public' …

    bucardo database postgres
    Previous page • Page 136 of 223 • Next page