Change controller generator template #70

Merged
merged 1 commit into from Jul 10, 2013

Conversation

Projects
None yet
4 participants
@MarceloCajueiro
Contributor

MarceloCajueiro commented Jul 9, 2013

Hey,

I changed the controller generator template to be more like rails 4 template, with some abstractions and using strong parameters.

Change controller generator template
Now it is more like the rails 4 controller template, using
before_(filter|action) to set the instance variable @resource and with
strong parameters.
@carlosantoniodasilva

This comment has been minimized.

Show comment Hide comment
@carlosantoniodasilva

carlosantoniodasilva Jul 10, 2013

Collaborator

Seems good, thanks mate.

Collaborator

carlosantoniodasilva commented Jul 10, 2013

Seems good, thanks mate.

carlosantoniodasilva added a commit that referenced this pull request Jul 10, 2013

@carlosantoniodasilva carlosantoniodasilva merged commit fdbcb0c into plataformatec:master Jul 10, 2013

1 check passed

default The Travis CI build passed
Details
@@ -22,6 +22,26 @@ def orm_instance_update(params)
orm_instance.update_attributes params
end
end
+
+ def controller_before_filter
+ if defined?(ApplicationController) && ApplicationController.respond_to?(:before_action)

This comment has been minimized.

Show comment Hide comment
@lucasmazza

lucasmazza Jul 10, 2013

Contributor

Isn't better to check against ActionController::Base and drop the defined? call? 😄

@lucasmazza

lucasmazza Jul 10, 2013

Contributor

Isn't better to check against ActionController::Base and drop the defined? call? 😄

This comment has been minimized.

Show comment Hide comment
@rafaelfranca

rafaelfranca Jul 10, 2013

Collaborator

👍

@rafaelfranca

rafaelfranca Jul 10, 2013

Collaborator

👍

This comment has been minimized.

Show comment Hide comment
@MarceloCajueiro

MarceloCajueiro Jul 10, 2013

Contributor

Indeed!

@MarceloCajueiro

MarceloCajueiro Jul 10, 2013

Contributor

Indeed!

This comment has been minimized.

Show comment Hide comment
@MarceloCajueiro

MarceloCajueiro Jul 11, 2013

Contributor

#71 :D

@<%= orm_instance.destroy %>
respond_with(@<%= file_name %>)
end
+
+ private
+ def set_<%= file_name %>

This comment has been minimized.

Show comment Hide comment
@rafaelfranca

rafaelfranca Jul 10, 2013

Collaborator

😡 hate this convention.

@rafaelfranca

rafaelfranca Jul 10, 2013

Collaborator

😡 hate this convention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment