spec/fake_app.rb in action_args-1.5.1 vs spec/fake_app.rb in action_args-1.5.2

- old
+ new

@@ -20,10 +20,11 @@ resources :kw_books # 2.0+ only resources :kw_keyreq_books # 2.1+ only resources :stores namespace :admin do + resources :accounts resources :books end end # models @@ -31,10 +32,15 @@ end class Book < ActiveRecord::Base end class Store < ActiveRecord::Base end +module Admin + def self.table_name_prefix() 'admin_' end + class Account < ActiveRecord::Base + end +end # mailers require "action_mailer/railtie" class UserMailer < ActionMailer::Base def send_email_without_args @@ -121,10 +127,19 @@ @store = Store.create! store render text: @store.name end end module Admin + class AccountsController < ::ApplicationController + permits :name, model_name: 'Admin::Account' + + def create(admin_account) + @admin_account = Admin::Account.create! admin_account + render text: @admin_account.name + end + end + class BooksController < ::ApplicationController permits :title def create(book) @book = Book.create! book @@ -141,7 +156,8 @@ class CreateAllTables < ActiveRecord::Migration def self.up create_table(:authors) {|t| t.string :name} create_table(:books) {|t| t.string :title; t.integer :price} create_table(:stores) {|t| t.string :name; t.string :url} + create_table(:admin_accounts) {|t| t.string :name} end end