diff options
-rw-r--r-- | app/controllers/file_request_controller.rb | 15 | ||||
-rw-r--r-- | app/models/info_request.rb | 5 | ||||
-rw-r--r-- | app/views/file_request/index.rhtml | 11 |
3 files changed, 23 insertions, 8 deletions
diff --git a/app/controllers/file_request_controller.rb b/app/controllers/file_request_controller.rb index 9b0f7c403..2bcab9ea9 100644 --- a/app/controllers/file_request_controller.rb +++ b/app/controllers/file_request_controller.rb @@ -4,7 +4,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: file_request_controller.rb,v 1.1 2007-08-04 11:10:25 francis Exp $ +# $Id: file_request_controller.rb,v 1.2 2007-08-21 11:33:45 francis Exp $ class FileRequestController < ApplicationController def index @@ -14,9 +14,16 @@ class FileRequestController < ApplicationController end def create - respond_to do |format| - format.html - end + @info_request = InfoRequest.new(params[:info_request]) + @info_request.save + + #redirect_to(:action => 'index') + render :action => 'index' + +# respond_to do |format| +# format.html +# end + end diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 9c84263bf..f79bf1dca 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -4,10 +4,13 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request.rb,v 1.1 2007-08-04 11:10:26 francis Exp $ +# $Id: info_request.rb,v 1.2 2007-08-21 11:33:45 francis Exp $ class InfoRequest < ActiveRecord::Base belongs_to :user +# validates_presence_of :user +# validates_numericality_of :user + validates_presence_of :title end diff --git a/app/views/file_request/index.rhtml b/app/views/file_request/index.rhtml index 935b4baeb..55a239e96 100644 --- a/app/views/file_request/index.rhtml +++ b/app/views/file_request/index.rhtml @@ -1,7 +1,7 @@ <h1>New request</h1> -<% form_for(:foi_request, @foi_request, :url => { :action => :create }, :html => { :id => 'writeForm' } ) do |f| %> - <%= error_messages_for :foi_request %> +<% form_for(:info_request, @info_request, :url => { :action => :create }, :html => { :id => 'writeForm' } ) do |f| %> + <%= error_messages_for :info_request %> <% fields_for :user do |u| %> <p> @@ -18,14 +18,19 @@ <% end %> <p> - <!-- <label for="foi_request_title">Title:</label> --> + <label for="info_request_title">Title:</label> <%= f.text_field :title, "size" => 50 %> <!-- (a one line summary of the information you are requesting, e.g. 'Crime statistics by ward level for Wales') --> </p> +<% +=begin %> <p> <%= f.text_area :body %> </p> +<% +=end +%> <p> <%= submit_tag "Create" %> |