aboutsummaryrefslogtreecommitdiffstats
path: root/railties
Commit message (Collapse)AuthorAgeFilesLines
* Use sprockets 3 in the Rails 5 releaseRafael Mendonça França2015-12-163-8/+7
|
* Merge pull request #22567 from gsamokovarov/introduce-application-recordRafael França2015-12-167-1/+29
|\ | | | | Introduce ApplicationRecord, an Active Record layer supertype
| * Introduce ApplicationRecord, an Active Record layer supertypeGenadi Samokovarov2015-12-167-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's pretty common for folks to monkey patch `ActiveRecord::Base` to work around an issue or introduce extra functionality. Instead of shoving even more stuff in `ActiveRecord::Base`, `ApplicationRecord` can hold all those custom work the apps may need. Now, we don't wanna encourage all of the application models to inherit from `ActiveRecord::Base`, but we can encourage all the models that do, to inherit from `ApplicationRecord`. Newly generated applications have `app/models/application_record.rb` present by default. The model generators are smart enough to recognize that newly generated models have to inherit from `ApplicationRecord`, but only if it's present.
* | Run railties generated app tests in test enveileencodes2015-12-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Running railties generated app tests in development env can cause unintended consequences. The environments are different and tests aren't meant to be run in development mode. The changes to the generator exposed this issue where the random test order in the generated apps could cause problems when those tests are run in development mode. Particularly we saw failures in `railties/test/application/rake_test.rb` generated apps that used the scaffold to create applications and then run the migration and immediately run the tests. The error we saw was `ActiveRecord::RecordNotFound: Couldn't find User with 'id'=980190962` and seemed to only occur if the destroy test ran first. I'm not entirely sure _why_ this causes that error to be thrown but I believe it is related to the environments being different.
* | Update test generators to use ActionDispatch::IntegrationTestAbdelkader Boudih2015-12-158-49/+61
| | | | | | | | | | | | | | | | | | | | | | | | In Rails 5.1 `ActionController::TestCase` will be moved out of Rails into it's own gem. Please use `ActionDispatch::IntegrationTest` going forward. This changes the generators to use `ActionDispatch::IntegrationTest` and the required URL setup (rather than symbols) for each of the controller actions. Updated fix to #22076.
* | Do not default to any SerializerSantiago Pastorino2015-12-153-8/+2
|/ | | | We will wait until 5.1 to make a decision
* Internal test migrations use the private 'Current' versionMatthew Draper2015-12-154-15/+15
| | | | | | | | Apart from specific versioning support, our tests should focus on the behaviour of whatever version they're accompanying, regardless of when they were written. Application code should *not* do this.
* Ensure generated migrations include a version numberMatthew Draper2015-12-153-14/+14
|
* Update seeds.rb.ttPaul Clegg2015-12-141-2/+2
| | | | Rahm Emanuel doesn't deserve to be in Rails.
* Revert "Merge pull request #22569 from seuros/remove-test-case"eileencodes2015-12-139-31/+30
| | | | | | | | | This reverts commit 9712a7a12b7f9e4dcef751ceda8a73c3f4beb11f, reversing changes made to 3e65c3d3886336e9145438cdeacaf4ebec6a48b8. Reverting because this caused test failures and while we have a followup branch there is still one failure that happens randomly and isn't straight forward to fix.
* Merge pull request #22569 from seuros/remove-test-caseEileen M. Uchitelle2015-12-139-30/+31
|\ | | | | Controller generators should be creating IntegrationTest stubs instea…
| * Controller generators should be creating IntegrationTest stubs instead of ↵Abdelkader Boudih2015-12-139-30/+31
| | | | | | | | ControllerTest
* | Merge branch 'rails-rake-proxy'Kasper Timm Hansen2015-12-133-6/+56
|\ \
| * | Implement Rake proxy for Rails' command line interface.Dharam Gollapudi2015-12-133-1/+57
|/ / | | | | | | | | | | | | Allows any Rake task to be run through `bin/rails` such as `bin/rails db:migrate`, `bin/rails notes` etc. The Rake tasks are appended to Rails' help output, and blend in as standard commands.
* | Merge pull request #22574 from gsamokovarov/scaffold-500Kasper Timm Hansen2015-12-133-3/+3
|\ \ | | | | | | Prevent a 500 in the default controller scaffold
| * | Prevent a 500 in the default controller scaffoldGenadi Samokovarov2015-12-133-3/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you update a record with no attributes, you'll hit a 500 from a guard in `assign_attributes` raising: ```ruby ArgumentError: When assigning attributes, you must pass a hash as an argument. app/controllers/users_controller.rb:44:in `block in update' app/controllers/users_controller.rb:43:in `update' test/controllers/users_controller_test.rb:37:in `block in <class:UsersControllerTest>' ``` Not a biggie, but may be quite confusing for the folks new to the framework.
* | Merge pull request #22573 from gsamokovarov/web-console-3-0Kasper Timm Hansen2015-12-132-3/+3
|\ \ | | | | | | Update web-console to 3.0.0
| * | Update web-console to 3.0.0Genadi Samokovarov2015-12-132-3/+3
| |/ | | | | | | | | Web Console 3.0.0 is compatible with Rails 5, while the 2.x.x releases aren't.
* | Nodoc Rails command.Kasper Timm Hansen2015-12-131-1/+1
| | | | | | | | | | | | | | The API isn't ready yet, which means we haven't documented it. People can't make their own commands, so there's no reason to show it in generated documentation.
* | let config.file_watcher be the way to enable the evented file watcherXavier Noria2015-12-134-26/+21
|/ | | | | | | | | | | Before this commit, the sole presence of the Listen constant enabled the evented file watcher (unless listen resorted to the polling backend). This way, applications may depend on listen for other stuff independently of this feature. Also, allows teams with mixed setups to decide at boot time whether the evented watcher should be enabled for each particular instance.
* show relative path the rerun snippet of test runner in rails engineyuuji.yaginuma2015-12-104-23/+63
| | | | | | | | | | | | | Since the absolute path is not required to re-run the test, modified so that unnecessary information is not displayed. ```ruby # before bin/rails test /path/to/blorgh/test/integration/navigation_test.rb:5 # after bin/rails test test/integration/navigation_test.rb:5 ```
* Fixed typo in mysql client parameterKent Sibilev2015-12-091-1/+1
|
* Remove duplicated assertion from api_app_generator testsJorge Bejar2015-12-091-2/+0
|
* We don't need to set config.debug_exception_response_format given that :api ↵Jorge Bejar2015-12-092-10/+0
| | | | is the default value for only API apps
* Make debug_exception_response_format config depends on api_only when is not setJorge Bejar2015-12-092-2/+37
|
* Add tests for api_only configuration settingJorge Bejar2015-12-091-0/+15
|
* Adjust comment in development.rb template file for app generatorJorge Bejar2015-12-091-3/+0
|
* Update Changelog with the added response_format option in AD::DebugExceptionsJorge Bejar2015-12-091-0/+9
|
* debug_exception_response_format needs to be writeable in ConfigurationJorge Bejar2015-12-091-2/+2
|
* Fix indent in generated Rails API env fileJorge Bejar2015-12-091-6/+6
|
* DebugException initialize with a response_format valueJorge Bejar2015-12-091-1/+1
|
* Add debug_exception_response_format config to configure DebugExceptionJorge Bejar2015-12-093-30/+43
| | | | behavior
* Do not include web-console in Rails API appsJorge Bejar2015-12-091-0/+2
|
* Response when error should be formatted properly in Rails API if local requestJorge Bejar2015-12-091-1/+1
|
* Fix #22232: rake test tasks exit status codeArkadiusz Fal2015-12-072-1/+10
| | | | | | | The exit status code was not set when tests were fired with `rake`. Now, it is being set and it matches behavior of running tests via `rails` command (`rails test`), so no matter if `rake test` or `rails test` command is used the exit code will be set.
* Clarify the need to run command twice.Kasper Timm Hansen2015-12-071-2/+2
| | | | | We had 2 pull requests erronously trying to remove the first command. Add some comments for clarity.
* Merge pull request #22508 from ↵Santiago Pastorino2015-12-072-0/+2
|\ | | | | | | | | y-yagi/remove_request_forgery_protection_from_rails_api remove `request_forgery_protection` initializer from rails api
| * remove `request_forgery_protection` initializer from rails apiyuuji.yaginuma2015-12-062-0/+2
| | | | | | | | | | In rails api, since default is so as not to use the `protect_from_forgery`, `request_forgery_protection` initializer I think that's unnecessary
* | Ditch `Commands` namespace for base command.Kasper Timm Hansen2015-12-064-83/+78
| | | | | | | | | | | | | | Reading `Rails::Commands::Command` feels excessive. Especially if users can subclass command to write their own commands — which I'd like to aim for. Switch to `Rails::Command` before we get too far into things.
* | Invert command and commands tasks reference.Kasper Timm Hansen2015-12-063-10/+14
| | | | | | | | | | | | | | We should first attempt to run commands through Rails command, and then fall back to trying the commands tasks. Because eventually the commands tasks should be their own commands.
* | Remove "run with rake" suggestion.Kasper Timm Hansen2015-12-061-22/+0
| | | | | | | | | | | | | | | | | | When attempting to run a `rake` task with `bin/rails`, Rails would see check that a Rake task existed and ask users if they meant to run it with rake. We don't need that anymore, as the goal is to have `rails` be a valid way to run rake tasks.
* | Add class level `run` to Rails command.Kasper Timm Hansen2015-12-062-22/+15
| | | | | | | | | | | | | | | | | | | | | | | | The class level version is responsible for changing a task name to command name, then finding a command and run it if there is one. The instance level `run` then makes sure arguments have been parsed into `@options` and runs the command by sending it. `Rails::Commands::Command.run` returns true to make it work within `Rails::CommandsTask`, but won't in the future when it handles all option parsing.
* | Replace `-> {}` with a proc.Kasper Timm Hansen2015-12-051-1/+1
| | | | | | | | | | | | | | | | When `parse_options_for` was called for a command that hadn't set up any option parsing with `options_for`, the `call` method would be sent to `-> {}`, which didn't like to be passed two arguments. Switch to `proc {}` which can accept several arguments.
* | Remove `_instance` suffix from command.Kasper Timm Hansen2015-12-051-2/+2
| | | | | | | | | | I want to streamline the wording around `command`, and not start pondering about instances.
* | Default `argv` to an empty array.Kasper Timm Hansen2015-12-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The `ARGV` constant in Ruby is not a string, it's an array as demonstrated by running: ``` $ ruby -e "p ARGV" => [] $ $ ruby -e "p ARGV" test/file.rb --version=2 => ["test/file.rb", "--version=2"] ```
* | Spruce up `command_for`.Kasper Timm Hansen2015-12-051-4/+1
| | | | | | | | | | | | * Ditch the instance methods local variable. * Prefer Ruby's default nil return, and remove else branch.
* | `exists?` isn't for users.Kasper Timm Hansen2015-12-051-1/+1
| | | | | | | | | | | | | | | | Checking that a command exists before running it is an implementation detail of the Rails command and Rake task world right now. Eventually I'd like to get rid of `exists?`, when I've worked out another way to fall back to run the old tasks.
* | Move `command_name_for` to private section.Kasper Timm Hansen2015-12-051-4/+4
| | | | | | | | | | Users shouldn't have to lookup the command name for a task. Put it in the private section, so it doesn't show up in any generated documentation.
* | Add Rails command infrastructure and encapsulate development cachingChuck Callebs2015-12-049-51/+144
| |
* | Disable FileEventedUpdateChecker for nowRafael Mendonça França2015-12-041-5/+1
| | | | | | | | | | Railsties tests are broken with this new update checker so we will use the old one until we have the tests fixed.