Ruby on Rails Friday, July 30, 2010

Stephan Wehner wrote:
> Pale Horse wrote:
>> Stephan Wehner wrote:
>>>
>>> Could it be that your template should say
>>>
>>> <%= f.select "tags", ... %>
>>>
>>> and not
>>>
>>> <%= select_tag "tags", ... %>
>>>
>>>
>>> Stephan
>>
>> Again, I've already checked. That was a desperate attempt by me as I
>> knew it shouldn't have any effect.
>
> Oh ok, then what is the controller code?
>
> Stephan

Nothing short of what should be there, nothing more:

def new
@article = Article.new
end

def create
@article = Article.new(params[:article])
if @article.save
flash[:notice] = "Successfully created article."
redirect_to admin_articles_path
else
render :action => 'new'
end
end

def edit
@article = Article.find(params[:id])
end

def update
@article = Article.find(params[:id])
if @article.update_attributes(params[:article])
flash[:notice] = "Successfully updated article."
redirect_to admin_articles_path
else
render :action => 'edit'
end
end
--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment