Thanks in advance for your insights....
I have searched for some help on this issue but so far nothing seems to
work. I am new to rails but the code was already written.
Process is: User enters data on the form, hits submit, new search is
created. This is a search app that allows you to create new 'searches'
and save the results and the parameters for later review.
The problem seems to be that the form data is not getting passed to the
controller after hitting the submit button. Instead I get "waiting for
localhost" on the browser status and finally rails gives an error. If I
comment out "@search.save" under 'def create' in the controller and
instead render inline @search it shows '#' instead of the actual form
data. Any thoughts??
**Here is the _form.html.erb code:**
<% form_for @search do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :project %><br />
<%= collection_select(:search, :project_id, current_user.projects,
:id, :name) %>
</p>
<p>
Search Words A<br />
<%= f.text_field :setA %>
<%= collection_select(:search, :setAList, Autoterm.all, :id, :name)
%>
</p>
<p>
Search Words B<br />
<%= f.text_field :setB %>
<%= collection_select(:search, :setBList, Autoterm.all, :id, :name)
%>
</p>
<p>
Automatically run search every day?<br />
<%= f.check_box :auto %><br/>
Include Google Search Results?<br/>
<%= f.check_box :google%><br/>
Use Find All Words Filter?<br/>
<%= f.check_box :atf%><br/>
Use Matching Word Filter?<br/>
<%= f.check_box :mwf%>
</p>
<p>
<%= f.label :notes %><br />
<%= f.text_area :notes %>
</p>
<p><%= f.submit "Create" %></p>
<% end %>
**This is the new.html.erb code that calls the above partial:**
<% title "New Search" %>
<%= render :partial => 'form' %>
<p><%= link_to "Back to List", searches_path %></p>
**Here is part of the search.rb code:**
require 'yaml'
require 'set'
require 'google'
require 'stemmer'
require 'quick_log'
class String
include Stemmable
end
class Search < ActiveRecord::Base
belongs_to :project
has_one :user, :through => :project
attr_accessor :setA, :setB, :setAList, :setBList, :google
before_create :setup_data
before_save :setup_data
def setup_data
@setax = setA.split' '
@setbx = setB.split' '
if setAList != 0
@setax << YAML.load(Autoterm.find(setAList).terms)
.....more code.......
**And finally, here is part of the searches_controller.rb code:**
class SearchesController < ApplicationController
before_filter :login_required
include ActionView::Helpers::DateHelper
def index
redirect_to projects_path unless admin?
@search = Search.all
end
def show
@search = Search.find_by_id(params[:id])
end
def new
@search = Search.new
end
def create
@search = Search.new(params[:search])
if @search.save
flash[:notice] = "Successfully created search."
redirect_to @search
else
render :action => 'new'
end
end
.....more code.....