Commit Graph

501 Commits

Author SHA1 Message Date
Jon Leighton
09d2671cb6 remove some artifacts of dependent_restrict_raises that I missed 2012-08-10 18:12:26 +01:00
Jon Leighton
5ad79989ef Remove the dependent_restrict_raises option.
It's not really a good idea to have this as a global config option. We
should allow people to specify the behaviour per association.

There will now be two new values:

* :dependent => :restrict_with_exception implements the current
  behaviour of :restrict. :restrict itself is deprecated in favour of
  :restrict_with_exception.
* :dependent => :restrict_with_error implements the new behaviour - it
  adds an error to the owner if there are dependent records present

See #4727 for the original discussion of this.
2012-08-10 17:45:06 +01:00
David Heinemeier Hansson
fb883318c8 Revert "The application generator generates public/humans.txt with some basic data". I dont consider this something most people is going to want most of the time. If you want to add it in your own app, knock yourself out. But it doesnt belong in Rails imo 2012-08-07 11:18:00 -05:00
Aleksey Magusev
5a7d31913b Add fkey attributes to join_table migration generator 2012-07-19 00:24:21 +04:00
Aleksey Magusev
211d88b71b Add join table migration generator
For instance, running

    rails g migration CreateMediaJoinTable artists musics:uniq

will create a migration with

    create_join_table :artists, :musics do |t|
      # t.index [:artist_id, :music_id]
      t.index [:music_id, :artist_id], unique: true
    end
2012-07-18 00:13:19 +04:00
Aleksey Magusev
0cae7c60ac Add references statements to migration generator
AddXXXToYYY/RemoveXXXFromYYY migrations are produced with references
statements, for instance

    rails g migration AddReferencesToProducts user:references
supplier:references{polymorphic}

will generate the migration with:

    add_reference :products, :user, index: true
    add_reference :products, :supplier, polymorphic: true, index: true
2012-07-08 23:03:05 +04:00
Wojciech Wnętrzak
8fe9b43b30 Fixed generating namespaced table_name_prefix in engines 2012-07-06 21:22:53 +02:00
Francesco Rodriguez
1c5722cdf6 remove test/dummy from gitignore when "plugin new -T" 2012-07-03 11:58:17 -05:00
Aleksey Magusev
94b230e189 Add polymorphic option to model generator
For instance,

    $ rails g model Product supplier:references{polymorphic}

generate model with `belongs_to :supplier, polymorphic: true` association and appropriate migration.

Also fix model_generator_test.rb#L196 and #L201
2012-06-27 18:12:28 +04:00
Rafael Mendonça França
d1136e6ad0 Merge pull request #6681 from arunagw/plugin_gen_fix
Plugin gen fix
2012-06-08 10:25:29 -07:00
Piotr Sarnacki
523820f81b Don't add sqlite3 to gemspec with -O on rails plugin new
(closes #6672)
2012-06-08 19:09:18 +02:00
Arun Agrawal
5fa87281ec We should not include engine.rake file into rake
if we are passing -T which is skip_test_unit

See issue #6673 for more details.

I saw that we are not creating dummy app even if
we do skip_test_unit.

Fixes #6673
2012-06-08 22:39:14 +05:30
Arun Agrawal
cbfcabc9e9 Removed protected as we already doing it above. 2012-06-08 22:39:10 +05:30
Fred Wu
686966a186 Fixed the application_controller require_dependency path generated by the app generator 2012-06-06 19:02:11 +10:00
Fred Wu
126586a5e6 Fixed the Gemfile when gemspec is skipped in the 'rails plugin new' command 2012-06-05 15:49:40 +10:00
Rafael Mendonça França
3015649783 Fix app_generator_test with the changes introduced at
f4d7af67ffc90f2542afa50c7579fc83ea4f45f2
2012-05-30 22:46:53 -03:00
Uģis Ozols
bd9953f11e Remove unnecessary comment. 2012-05-23 11:45:08 +03:00
Alexey Vakhov
fe7038eac8 Use new hash syntax for generators gem method
The Gemfile of new application uses ruby 1.9 hashes. Gem method of
generators should use them too. It prevents from mixing two kinds of
syntax in one file.
2012-05-22 13:26:06 +04:00
Piotr Sarnacki
29d17d3ab6 Use require_dependency in generated controllers
Using require in development mode will prevent required files from
reloading, even if they're changed. In order to keep namespaced
application_controller reloadable, we need to use require_dependency
instead of require.
2012-05-22 01:40:51 -07:00
Piotr Sarnacki
7c95be54b4 Fix generators to help with ambiguous ApplicationController issue
In development mode, dependencies are loaded dynamically at runtime,
using `const_missing`. Because of that, when one of the constants is
already loaded and `const_missing` is not triggered, user can end up
with unexpected results.

Given such file in an Engine:

```ruby
module Blog
  class PostsController < ApplicationController
  end
end
```

If you load it first, before loading any application files, it will
correctly load `Blog::ApplicationController`, because second line will
hit `const_missing`. However if you load `ApplicationController` first,
the constant will be loaded already, `const_missing` hook will not be
fired and in result `PostsController` will inherit from
`ApplicationController` instead of `Blog::ApplicationController`.

Since it can't be fixed in `AS::Dependencies`, the easiest fix is to
just explicitly load application controller.

closes #6413
2012-05-20 16:28:02 -07:00
Carlos Antonio da Silva
573448f011 Remove warning in namespaced generator test 2012-05-19 09:17:11 -03:00
Piotr Sarnacki
bd838c0e74 Fix railties tests
Minitest uses different signature for assert_no_match, so we have to
swap arguments.
2012-05-19 04:53:35 -07:00
Piotr Sarnacki
0f5cc34ab5 Revert changes related to bundle install fixes in rails new
Reverted changes:
  f3482a9 Fix tests in railties
  5904295 improve #6318
  aed906a prevent using already loaded Gemfile for 'bundle install'

In order to fix this, we need a fix in bundler related to GEM_PATH,
which will allow to run tests properly. I will get this changes back
when it happens.
2012-05-17 11:33:40 -07:00
Piotr Sarnacki
f3482a9fb1 Fix tests in railties
Since `bundle install` was fixed in `rails plugin new`, it
now requires `rails 4.0.0.beta` version in filesystem when
running tests. Instead of providing it, we can run tested
command with `--dev` option, to use rails from the local
directory.
2012-05-15 22:48:05 -07:00
Michal Papis
5904295b23 improve #6318 2012-05-15 22:31:08 -07:00
Carlos Antonio da Silva
017632fe2b Remove not used date variable and another test warning 2012-05-14 12:31:51 -03:00
José Valim
f4c8f8c5aa Remove assertion on date from humans.txt tests 2012-05-14 18:09:53 +03:00
Oscar Del Ben
27dd500254 Refactor App Generator Test 2012-05-13 09:44:43 -07:00
Piotr Sarnacki
b14d1cd8ae Failing test for #6251 2012-05-10 17:37:12 -07:00
Arun Agrawal
757a0ce6aa Adding test for humans.txt 2012-05-08 18:02:25 +05:30
Arun Agrawal
1cfa34f83e Fix build for railties generators 2012-05-02 17:31:29 +05:30
Arun Agrawal
1206e88a75 build fix for SharedGeneratorTests 2012-05-02 16:27:22 +05:30
Carlos Antonio da Silva
a6c41601fe Build fix for plugin new generator change
Related to a06a84bf77082a7435973fa1b6c8254fb410f243
2012-05-01 23:29:57 -03:00
Piotr Sarnacki
ed10107fa1 Fix tests 2012-05-01 16:25:03 -07:00
José Valim
64a54c3f9e Merge pull request #5530 from malclocke/add_option_to_skip_index.html_on_rails_generate
Added a generator option to skip the public/index.html file
2012-04-30 00:26:45 -07:00
Alexey Vakhov
5decf8352d Namedspaced generator indent method test refactoring 2012-04-26 18:16:00 +04:00
José Valim
33d80919ff Merge pull request #5902 from avakhov/generator-no-indent-blank-lines
Don't indent blank lines in named base generators
2012-04-25 06:15:12 -07:00
Alexey Vakhov
6ac9e493fb Don't indent blank lines in named base generators 2012-04-25 12:01:33 +04:00
Alexey Vakhov
93bcb0c268 Remove lonely number sign 2012-04-25 11:51:33 +04:00
Santiago Pastorino
3df776c9ad Fix test 2012-04-16 23:36:09 -03:00
Arun Agrawal
ba3e27532b fix scaffold_generator_test.rb and model_generator_test.rb
Broken after this 6a054b0038bac288a1f6e45feb5470f4ee492081
2012-04-16 12:10:39 +05:30
ask
4bb76eecfe "rails new -h" shows message in rails directory 2012-04-09 22:26:52 +06:00
Piotr Sarnacki
fff3e75e1c Usage file in generators shouldn't be fetched only based on source_root
In case `source_roout` is not set, `default_source_root` is used,
which includes also `templates` directory. If there is no `templates`
directory, `default_source_root` is not available and USAGE will not
be displayed. USAGE should be also checked based on default
directory excluding `templates`.
2012-04-01 23:51:18 +02:00
Marcelo Silveira
86d1dfb821 Avoid another blank line in generated migration and remove assertion as per @spastorino request 2012-03-21 19:28:34 -03:00
José Valim
14b2cf6a0a Merge pull request #5532 from mhfs/migration_blank_line
Remove blank line from generated migration
2012-03-21 00:34:38 -07:00
Travis Jeffery
b2a59388b2 Generate Migration Thats Adds Removed Index
When generating a migration that removes a field with an index, the down
will add both the field and its index.
2012-03-21 01:20:35 +00:00
Marcelo Silveira
c63306b1a8 Remove blank line from generated migration 2012-03-20 21:44:45 -03:00
Ivan Vanderbyl
5c1109a68e Added a generator option to remove the public/index.html file when generating a new Rails application
The option is:
-i, [--skip-index-html]        # Skip public/index.html file
2012-03-21 13:19:14 +13:00
Arun Agrawal
62e0337db1 Build fix for app_generator_test.rb 2012-03-18 10:24:18 +05:30
José Valim
6db930cb5b Remove --http. 2012-03-14 22:30:01 +01:00