Created
January 31, 2012 16:44
-
-
Save smooki/1711509 to your computer and use it in GitHub Desktop.
no association in params for create ...
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
class PoolsController < ApplicationController | |
def index | |
@event = Event.find params[:event_id] | |
@pools = @event.pools | |
end | |
def new | |
type = nil | |
type = params[:type] if ["date", "text"].include?params[:type] | |
@event = Event.find params[:event_id] | |
@new_pool = @event.pools.build(:user => current_user) | |
if type == "date" | |
#@yesno_pool = YesNoDatePool.new(:user => current_user, :event => @event) | |
#@multi_pool = MultipleDatePool.new(:user => current_user, :event => @event) | |
@new_pool.type = "YesNoDatePoll" | |
foo = 0 | |
else | |
end | |
end | |
def create | |
pool = params[:pool] | |
if pool.instance_of?(YesNoDatePool) | |
toto | |
end | |
if @pool.save | |
flash[:notice] = "Pool created" | |
else | |
flash[:error] = "Pool not created" | |
end | |
end | |
end |
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
<div id="sondage-creation"> | |
<h2 class="title">Nouveau sondage (nommer)</h2> | |
<%# | |
new_event_pool GET (/:locale)/events/:event_id/pools/new(.:format) | |
{:locale=>/en|fr/, :action=>"new", :controller=>"pools"} | |
%> | |
<%# form_for(:project, @project, :url => {:controller => "projects",:action => "update"}) %> | |
<%#= form_for([@event, @new_pool], :as => :poll , :url => {:controller => "pools", :action => "create"}, :validate => true) do |f| %> | |
<%= form_for [@event, @new_pool], :validate => true do |f| %> | |
<%= f.hidden_field :user_id, @new_pool.user_id %> | |
<%= f.hidden_field :event_id, @new_pool.event_id %> | |
<fieldset> | |
<div class="left"> | |
<h3><%= t '.question' %></h3> | |
<%= f.text_area :question %> | |
<h3><%= t '.message' %></h3> | |
<%= f.text_area :message %> | |
</div> | |
<!--<div class="right">--> | |
<!--<h3><%#= t '.test_one_date' %> <input name="questionType" value="simple" type="radio"></h3>--> | |
<!--<ul>--> | |
<!--<li><input name="" value="oui" type="text"></li>--> | |
<!--<li><input name="" value="non" type="text"></li>--> | |
<!--</ul>--> | |
<!--<h3><%#= t '.test_multiple_date' %> <input name="questionType" value="multiple" type="radio"></h3>--> | |
<!--<ul>--> | |
<!--<li><input name="" type="text"></li>--> | |
<!--<li><input name="" type="text"></li>--> | |
<!--<li><input name="" type="text"></li>--> | |
<!--<li><input name="" type="text"></li>--> | |
<!--<li><input name="" type="text"></li>--> | |
<!--</ul>--> | |
<!--</div>--> | |
</fieldset> | |
<div class="submit"> | |
<%= f.submit t '.validate' %> | |
<input value="Valider le sondage" type="submit"><br> | |
<a href="" class="button"><span>Illustre ton songage</span></a> | |
</div> | |
<% end %> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment