Spree Routes Not Working after Database Reset - ruby-on-rails

I recently had to reset my development database (because of Spree migration complications) and now some of my Spree routes seem to be missing.
I have the following Spree-related gems:
gem 'spree', '>= 4.3'
gem 'spree_auth_devise', '~> 4.0'
gem 'spree_gateway', '~> 3.6'
I have this in my routes.rb file as the only spree-specific route...nothing custom:
mount Spree::Core::Engine, at: '/store', as: 'spree'
However, when I go to http://localhost:3000/store I get an error saying No route matches [GET] "/store".
This is especially strange because when I run rails routes the first thing that comes up is:
Prefix Verb URI Pattern Controller#Action
spree /store Spree::Core::Engine
I have run rake spree_auth:admin:create and created (and confirmed) an admin user, if that helps.
Can anyone see why my Spree isn't appearing?

Related

Cookies, Authentication, Signing up - rails 4 and Ember js

So I created a rails app with the ability to sign up, receive a welcome email, sign up - reset the password (again receive an email) and be able to sign in with the option to remember the password. fully tested, both integration and back end tests.
Now I want to bring ember js into this so I added the following gems ...
gem 'ember-data-source', '>= 1.0.0.beta.3', '< 2.0'
gem 'emblem-rails', '~> 0.1'
gem 'ember-auth-rails', '~> 5.0'
gem 'ember-auth-request-jquery-rails', '~> 1.0'
gem 'ember-auth-response-json-rails', '~> 1.0'
gem 'ember-auth-strategy-token-rails', '~> 1.0'
gem 'ember-auth-session-cookie-rails', '~> 1.0'
gem 'ember-auth-module-ember_data-rails', '~> 1.0'
# for testing, in the testing section:
gem 'jasmine'
And then in my routes I went and did:
namespace :api do
namespace :v1 do
resource :users
end
end
And added the appropriate user contoller.
My question for you guys is:
I want to add ember to handle ALL the update, delete, create for users.
Ember for dealing with sessions and cookies.
Ember for allowing you to reset your password and receive welcome emails.
I have two sets of controllers, one for regular html - so your regular controller, and one under api/v1/users_controller.rb
What tutorials or steps are included to do this? I built everything from scratch instead of using devise ...
That's a mouthful of gems. Have you looked at this? http://coderberry.me/blog/2013/07/08/authentication-with-emberjs-part-1/

Gumby Framework in Rails Project - File to import not found

I have a simple rails project (ruby 1.9.3, rails 3.2.13), and I am attempting to incorporate the Gumby CSS Framework. The framework requires Compass, with modular-scale.
For sake of completeness the majority of the post contains information, skip to the end for the actual problem.
The working directory is being watched with
$ compass watch`
Compass was incorporated into the project with:
compass create --app rails \
-l ./app/assets/stylesheets/gumby/ \
--using modular-scale
The contents of config/compass.rb is:
require 'modular-scale'
project_type = :rails
And the location of Gumby source (SCSS) is app/assets/stylesheets/gumby.
The resulting compiled css appears in public/assets/gumby/gumby.css.
The following is within my Gemfile
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'compass-rails'
gem 'coffee-rails', '~> 3.2.1'
gem 'modular-scale'
gem 'gumby-rails'
gem 'uglifier', '>= 1.0.3'
end
And bundle install completes without errors.
However...
The following error message appears on all served pages:
Sass::SyntaxError in Users#index
Showing PROJECT_ROOT/app/views/layouts/application.html.erb where line #5 raised:
File to import not found or unreadable: compass/typography/vertical_rhythm.
Load path: Sass::Rails::Importer(PROJECT_ROOT/app/assets/stylesheets/gumby/_base.scss)
(in PROJECT_ROOTr/app/assets/stylesheets/gumby/_base.scss)
After hours of tinkering, I am at a loss as to the reason why Sass cannot read the Compass library.
I believe I found the solution from https://stackoverflow.com/a/9021785/1280997.
Removing config/compass.rb and rebooting the server fixes the immediate problem, however I am now faced with:
Undefined mixin 'box-sizing'.
(in PROJECT_ROOT/app/assets/stylesheets/gumby/_base.scss)
Ok, after much digging, I've found a way to incorporate Gumby into Rails, however I've lost the ability to edit the scss in the process. I did this using the gumby-framework gem. Setup was simple, following the README.

New Rails 3.1.3 + Datamapper routing assets issue

I am eager to try out DataMapper for a new Rails project. I created my project using the following command:
rails new project_name -m http://datamapper.org/templates/rails.rb
I decided to test out my application by running:
rails server
When I go to the generic home page that is created, I can't see any images. I get an error stating:
ActionController::RoutingError (No route matches [GET] "/assets/rails.png")
If I create any other scaffolds and visit those pages, I get similar errors about the stylesheets or javascript not found. I double checked to ensure that a regular Activerecord-rails application worked (which it did). I'm rather puzzled. Any help would be greatly appreciated. Thank you :)
For some reason, DataMapper's Rails template completely replaces the standard Gemfile with their own, which doesn't include any of the asset handling stuff (it also removes a handful of other things like jQuery support, TestUnit, ActionMailer...).
You'll want to add these back in to your Gemfile after setting up the new application:
group :assets do
gem 'sass-rails', '~> 3.1.5'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
Per Frederick's suggestion below, you'll also want to add this into your config/application.rb file:
require 'sprockets/railtie'
I opened an Issue and submitted a pull request to fix this.
Update: As of 1/5/2012, this is now fixed. The template behaves nearly identical to a standard Rails 3.1 app with the only change being ActiveRecord being replaced with DataMapper. Assets/jQuery support now works.

AssetNotPrecompiledError when using html5-rails gem in production env

I've got html5-rails and compass-html5 working in devlopment on rails 3.1 but when I run my app in production mode and try to visit my homepage, I get the following:
Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError in Home#index
polyfills.js isn't precompiled
The thing is that localhost:8080:/assets/polyfills.js does display. I suspect there is a problem with my methods:
Steps to reproduce:
1 Create new rails app with home controller, index action and set up a root route and delete public/index.html and views/layouts/application.html.erb
2 Add following to Gemfile
gem 'rails', '~> 3.1.0'
gem 'unicorn'
group :assets do
gem 'compass', "~> 0.12.alpha.0"
gem 'sass-rails', "~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
gem 'compass-html5', :git => 'https://github.com/sporkd/compass-html5.git'
gem 'html5-rails', :git => "https://github.com/sporkd/html5-rails.git"
end
3 Run rails g html5:install to create /config/compass.rb file
4 Create /config/initializers/sass.rb containing following code:
Rails.configuration.sass.tap do |config|
config.load_paths << "#{Gem.loaded_specs['compass'].full_gem_path}/frameworks/compass/stylesheets"
end
5 Run RAILS_ENV=production bundle exec rake assets:precompile
6 Run unicorn -E production (or rails s -e production if you're on webrick) and visit root url
7 Observe bug
The correctly minified respond-md5.min.js and modernizr-md5.min.js are present in /public/assets. The compiled js code does appear when I visit localhost:8080/assets/modernizr.min.js. The server error is thrown when I try to visit my homepage.
I suspect there is an error in my method. I have asked the very same question here on github.
I managed to fix this by adding polyfills.js to application.rb
config.assets.precompile += %w( polyfills.js )
i just got the same error, and the issue was that my file was missing...

Getting started with Spree Installation Trouble

So...
It looks like there are two ways to get started with Spree as far as implementing it into your Rails application, neither of which work...
Method A
$ spree mystore
Result
spree: command not found
Method B
$ rails cart
$ cd cart
$ rails g spree:site
Result
I get spit out the man page for the "rails" command as if it has no idea what I'm talking about.
Usage:
rails new APP_PATH [options]
Options:
-J, [--skip-prototype] # Skip Prototype files
-T, [--skip-test-unit] # Skip Test::Unit files
[--dev] # Setup the application with Gemfile pointing to your Rails checkout
-G, [--skip-git] # Skip Git ignores and keeps
-m, [--template=TEMPLATE] # Path to an application template (can be a filesystem path or URL)
-b, [--builder=BUILDER] # Path to an application builder (can be a filesystem path or URL)
and so on...
Here's what I've done:
$ sudo gem install spree #and all of its dependencies
My Gemfile:
source :rubygems
# Generic gem dependencies first
gem 'mysql2'
gem 'newrelic_rpm'
# Followed by spree itself first, all spree-specific extensions second
gem 'spree'
gem 'spree_active_shipping', :git => 'https://github.com/spree/spree_active_shipping.git'
gem 'spree_product_assembly', :git => 'git://github.com/spree/spree-product-assembly.git'
gem 'spree_static_content', :git => 'git://github.com/spree/spree_static_content.git'
# EOF
And ran
$ bundle install
So what am I missing, my wonderful S.O. community?
As they described on their Github, you have to a create a new rails application and add gem 'spree' to gemfile and then do bundle install.
Got this figured out.
HAS to be Rails 3. I became a big boy yesterday and upgraded.
Ran into a crapton of problems after this so make sure spree gemversion matches in gemfile and with your gem list (mine was 0.50.2) this doesn't really happen by default.
This
gem 'spree_static_content', :git => 'git://github.com/spree/spree-static-content.git'
has to become
gem 'spree_static_content', :git => 'git://github.com/spree/spree_static_content.git'
in your gemfile, the documentation is wrong.
You have to edit line #6 in /home/user/.bundler/ruby/1.8/spree_active_shipping-cb4f80aeb9c9/lib/tasks/active_shipping_extension_tasks.rake to reflect "RAILS_ROOT" instead of "something_shippy_thingy.root"
You have to run
rails g spree_product_assembly:install
rails g spree_static_content:install
rake db:migrate
So yeah, a lot of digging and most of this NOT in the documentation. Hopefully someone else finds this and its useful

Resources