search for: shopscontrol

Displaying 2 results from an estimated 2 matches for "shopscontrol".

2011 Jul 14
1
RoutingError with RSpec Controller test on Scoped Route
So I have a route that looks like this: scope "4" do scope "public" do scope ":apikey" do resources :shops end end end And a bunch of controller specs, an example of which looks like this: describe ShopsController do describe "when responding to a GET" do context "#new" do it "should create a new instance of the shop class" do get :new @shop.should_not_be_nil end end end end In rake routes, as well as via a web browser, this contro...
2012 Aug 17
3
Rails doesn't validate create_model or build_model (has_one association)
...Shop. Rails is not validating when I tried create_shop or build_shop, neither in the browser nor the rails console. My code: class Shop < ActiveRecord::Base attr_protected :user_id belongs_to :user validates_presence_of :name, :primary_address, :city, :country_code, :currency end class ShopsController < ApplicationController before_filter :signed_in_user, except: [:index, :show] before_filter :correct_user, only: [:edit, :update, :currency, :update_currency] def new @shop = Shop.new end def create @shop = current_user.build_shop(params[:shop]) if @shop.save f...