purpletonic

1

votes
1

answer
813

views

Rails 3.1 error 406 response when downloading web fonts

I'm having problems serving web fonts through Rails 3.1, within a Spree 0.70 application using compass (which I don't think should make a difference) I have a scss file which contains the declarations: @font-face { font-family: 'RokkittRegular'; src: font_url('fonts/store/rokkitt-font/Rokkitt-webf...
purpletonic
1

votes
2

answer
791

views

How do I link the same page in another language with the i18n gem for Refinery CMS?

I'm converting a site into the Rails based Refinery CMS, I've setup the i18n refinery cms gem and I've created multi-lingual versions of my pages. I'd like to create a locale switcher on the page, so that a user can click on a flag and switch between the various languages for the particular page tha...
purpletonic
5

votes
1

answer
1.1k

views

What is the currently accepted way to embed forms in Refinery CMS sites?

I'd like to create a couple of forms on a Refinery based CMS site. One is a contact form, and another is a variation on this contact form with a few additional fields. For this form, I've looked at the Refinery inquiry gem but I can't seem to find a way of modifying the form for the additional field...
purpletonic
2

votes
1

answer
1.7k

views

Arbitrary attributes error with has_one association and Factory Girl

I'm trying to build a basic shopping cart for a Rails app I'm working on. Nothing special, - the shopping cart has many line_items - each line_item has_one product associated and a quantity with it class Cart < ActiveRecord::Base attr_accessible :line_items has_many :line_items, :dependent => :de...
purpletonic
12

votes
1

answer
2.4k

views

Adding a step to the Spree checkout process

I'm trying to add an extra step to my Spree 1.2 store which will allow a customer to create a subscription. I've inserted the step, and rendered the correct view, but when the user clicks 'save and continue' the next step is rendered, but nothing is actually saved. I understand that I need to add a...
purpletonic
2

votes
1

answer
1.7k

views

401 redirect loop with Active Admin and Devise

I have an application with Devise (2.2.3) and Active Admin (0.5.1) I installed Devise first, and then Active Admin afterwards. The entire app needs to sit behind a login, so in my application controller I have the following: before_filter :authenticate_user! However, since installing Active Admin t...
purpletonic
1

votes
1

answer
1.6k

views

React Rails Component is not defined

I'm trying to get the react-rails gem (version 2.1) working in my Rails 4.2.4 app. I've gone through the setup steps in the Readme and I'm using webpacker for the js preprocessing. I have a component inside of app/javascript/components/label.js that looks like this: import React, {PureComponent} fro...
purpletonic
1

votes
2

answer
8.2k

views

How do I redraw and reorganise the elements within an Isotope container upon reordering the DOM?

As per this JSFiddle, I create an Isotope container which contains each of my elements, upon clicking one of the links (bottom left) I'd like to reorder the elements, pulling the matched elements to the left of my container. I do this by removing them from the DOM and shifting them to the top of th...
purpletonic
1

votes
3

answer
680

views

Shared message queues between apps with Heroku

I have two web applications, both to be hosted on Heroku. One is the front-end app, in the sense that all consumer facing actions will be through this app. New sign-ups, etc. The other is the back-end, this ones deals with all of the processing of new customers, their orders, and associated business...
purpletonic
2

votes
2

answer
856

views

How do I test custom Koa middleware for error handling?

As part of a migration of an older app from ExpressJs to Koa JS (v1). I've written a piece of middleware to handle any errors that occur. It looks something like this: module.errors = function * (next) { try { yield next; } catch (err) { switch(err && err.message) { case: 'Bad Request': this.status...
purpletonic
2

votes
1

answer
1.5k

views

Spree themeing with Deface: What css selector will select the first h3 from this code?

I'm trying to theme a Spree site using deface. Deface uses css selectors to select elements and then modify them, so in theory if you've only got experience with css2/3 and have any ideas then please leave an answer below. Given this file (snippet below of this below) How do a select the very first...
purpletonic
2

votes
1

answer
604

views

Using Browserify on only a subset of files in a folder within a Gulp task

Typically with Browserify, if you want to combine a number of files, you run something like the following: gulp.task('build-tests', function() { var b = browserify({ entries: ['./lib/some_specs.js', './lib/some_more_specs.js'] }); b.bundle().pipe(source('specs.js')).pipe(gulp.dest('./dist')); }) I w...
purpletonic
3

votes
2

answer
1.6k

views

Using node-xmpp-bosh to forward messages to an xmpp server on another machine

I'm trying to learn and understand how XMPP works. As I understand it, node-xmpp-bosh is a connection manager. A connection manager is not a full blown xmpp server, but sort of acts like a proxy, and forwards the xmpp requests on to a dedicated xmpp server. This results in saving the dedicated xmp...
purpletonic
8

votes
2

answer
5k

views

How do I create a nested form using Mongoid embedded resources in Rails 3?

I have a Recipe model, which has Ingredients embedded in it, using Mongoid. class Recipe include Mongoid::Document include Mongoid::Timestamps field :title, :type => String embeds_many :ingredients accepts_nested_attributes_for :ingredients, :reject_if => lambda { |a| a[:title].blank? }, :allow_des...
purpletonic