New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sexier migrations #1163
Sexier migrations #1163
Conversation
Now you can omit |t| block parameter and all the t. from your migration code, that means, the syntax looks more Rails-3-ish, like the routes DSL and ActionMailer DSL. Also, this change won't break any of your existing migration files, since the traditional syntax is still available.
If this pull request is applied I think this idiom should become the recommended one, and thus all example code in documentation would need to be updated to reflect that. Only the API docs of create_table would mention the block may receive a argument. |
Yes, agree. And of course I'm willing to work on that when I'm sure the syntax will be accepted. |
+1, looks sweet. Lets do this if we can. |
+1 for simplified api, definitely have a more "Rails 3 feel" |
asanghi what he says +1 |
I also give this a 👍, but it is too late for it to go into 3.1 so we should return to this once 3.1 is out the door. |
I am in general -1 for instance eval. instance eval has its set of gotchas that does not make it worth imo. |
I'm OK with this change, but I want to see what methods we would expose by doing In any case, I agree with @jonleighton that this should be considered for 3.2. I wish somebody would branch for 3.1 so we can start merging in 3.2 features. :-P |
Given the if blk.arity == 1
blk.call(td)
else
td.instance_eval(&blk)
end |
+1 |
We ❤️ this already. The only stuff that really would later are a few blog posts as far as dissemination of information is concerned. Why wait til 3.2 to introduce yet more changes in migrations. If we're going to have this might as well make the changes now, still not too late. 👍 on @myronmarston's changes. |
3.1 is feature complete. I have the same concern that @tenderlove has, it could be nice to see what are we going to expose to the table_definition objects. |
-1, I'd prefer we weren't adding extra code for the sake of making this two characters shorter per line |
+1, this seems in line with the direction Rails has taken, e.g. in the routing DSL. |
@radar please compare the time that it takes for a machine to interpret these lines, what three or four lines, and the time for a human to write those two characters. You'll find that this is +1 +1 :) |
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
+1. Cleaner interfaces is always best. |
This is a good candidate for 3.2, let's merge to master and update documentation. |
This is green for 3.2, we just need docs/guides updates. |
+1 |
FTR this doesn't have documentation. @tenderlove what about this suggestion?#1163 (comment) |
@vijaydev the suggestion seems good. Can you put together a pull request with tests? Thanks! |
Let me propose a new Rails-3-ish cooler syntax for the database migrations.
This pull request enables you to remove the block parameter and t. t. t. t. t. t. t. ... from your migration code.
This is actually the same thing with what I posted here in January, so please refer to this ticket for details.
https://rails.lighthouseapp.com/projects/8994/tickets/6339
The reasons why I made another pull request today are:
So, @tenderlove, can you please take a look at the former ticket and this pull request, then give me your thoughts?
Thanks in advance!