Created
May 20, 2013 18:29
-
-
Save dan1d/5614223 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
en el modelo | |
def self.build_survey(current_user) | |
@survey = current_user.surveys.build | |
end | |
y en el controller lo llamas | |
@survey = Survey.build_survey(current_user) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lo implemente asi:
en el modelo
def self.build_survey(current_user)
@Survey = current_user.surveys.build
@question = @survey.questions.build # Esto es chancho? deberia hacer otro metodo q cree la question?
@Survey
end
en el controller:
def new
@Survey = Survey.build_survey(current_user)
end