From: Tom Dunn Date: 2009-08-10T14:09:47+09:00 Subject: Font selector using radio button I have looked all around to try and find an answer to this. I have the Agile book and although it has lots of information, it has relatively little on radio buttons. I have a website in which I want users to be able to format their posts in relation to font and color. My goal is to allow them to click a radio button next to their choice of font and their choice of color. So far I have been unable to find anything in the book, on this site, or on the internet to help me out. Here is my controller: class PostsController < ApplicationController # GET /posts # GET /posts.xml def index @posts = Post.find(:all, :order => "created_at DESC") respond_to do |format| format.html # index.html.erb format.xml { render :xml => @posts } end end # GET /posts/1 # GET /posts/1.xml def show respond_to do |format| format.html # show.html.erb format.xml { render :xml => @post } end end # GET /posts/new # GET /posts/new.xml def new @post = Post.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @post } end end # POST /posts # POST /posts.xml def create @post = Post.new(params[:post]) respond_to do |format| if @post.save format.html { redirect_to(@post) } format.xml { render :xml => @post, :status => :created, :location => @post } else format.html { render :action => "new" } format.xml { render :xml => @post.errors, :status => :unprocessable_entity } end end end end Here is the part of my view of the post form: <%= error_messages_for :post %>
<% form_for(@post) do |f| %> #there is other stuff here it just isn't important and is a little long. #here is where I want the buttons. I just have no idea how to do it.
Sorry if this is something very simple. I am new to ruby and thus don't have much experience. Any help would be greatly appreciated. -- Posted via http://www.ruby-forum.com/.