Displaying 20 results from an estimated 4000 matches similar to: "One to Many Relationship Issues"
2006 Aug 12
2
Ferret Issues
Hi,
I have installed the ferret gem (on WIN XP). My search and result view
is working, but it comes back with empty results all the time. It seems
like ferret is building the index (there is 3 binary files in the index
directory).
If I add the line:
acts_as_ferret :fields =>
2006 Aug 12
4
Ferret Wierdness
Hi,
I have installed the ferret gem (on WIN XP). My search and result view
is working, but it comes back with empty results all the time. It seems
like ferret is building the index (there is 3 binary files in the index
directory).
If I add the line:
acts_as_ferret :fields => [''title'',''description'',''price'',''website_url'']
2006 Jul 21
1
Passing a variable between methods
Hi,
I am trying to add search functionality to may application. I am
struggeling to pass my query to the controller and then show all my
search results in another view. How would I do this?
Model:
class Advert < ActiveRecord::Base
belongs_to :user
def self.search(query)
if !query.to_s.strip.empty?
tokens = query.split.collect {|c| "%#{c.downcase}%"}
2006 Apr 02
5
Showing current user''s information and saving
Hi,
I am logging users in and keeping them in session. The problem I am
having is showing only a certain logged in user''s information.
In the Adverts_Controler:
def show
@advert = Advert.find(params[:id])
end
I am also having issues with saving an advert for an user:
def create
@advert = Advert.new(params[:advert])
if @advert.save
flash[:notice] = ''Advert
2007 Aug 29
2
assign local variable instead of instance variable.
Hello,
I have a view that generates a list of adverts with <%=
render :partial => ''advert'', :collection => @adverts %>
I have the render call described with
@controller.template.should_receive(:render).with(:partial =>
''advert'', :collection => @adverts)
Bu when i was about to describe my partial i got stuck.
My partial _advert.rhtml:
2007 Jan 20
3
Making tables with SQLight
Hi, Im using locomotive and running SQLight. Im confused about making
tables with sqlight.
Im following the depot example from ''agile web development with rails''.
When trying to make the table ''products'' is there a difference when
using SQLight rather than MySQL?
Here is the DDL for MySQL, how do I make this table with SQLight?
-
drop table if exists
2006 Apr 26
1
rake db_schema_dump make syntax error
rake migrate bug with datetime:
> rake db_schema_dump
produced a bad schema.rb that isn''t valid ruby, it has an invalid default, unless ruby
takes bare words:
t.column "date_available", :datetime, :default => Sun Jan 01 00:00:00 Arabic Standard
Time 2006, :null => false
I don''t think the Baghdad time zone should matter.
ruby 1.8.4, rails 1.1.2,
2007 Dec 22
8
Rails 2.0 scaffold
Hey guys,
I posted the other day about scaffold not working and i was told that it
was rails 2.0 doing this. (btw i''m using adgile web development)
I have read on the internet that you need to put extra stuff like title,
description......
So i did this:
C:\ruby\depot>ruby script\generate scaffold Product Admin id:int
title:varchar(1
00) description:text image_url:varchar(200)
2006 May 19
2
Problems with belongs_to table joins
I am looking for a little assistance with a problem I have with a simple
table join using Rails. I am a relative newbie to both Ruby and Rails so
any help would be greatly appreciated . I have two tables products and
product_formats.
create table products (
id int not null auto_increment,
title varchar(100) not null,
product_format_id integer
2006 Sep 26
1
Error while generating scaffold
Hello,
When I run the command:
"ruby script/generate scaffold Product Admin"
I receive the following error after the usual changed files info:
"Couldn''t find ''product'' generator"
The command is based on "Agile Web Application Development with Rails"
first edition on page: 57. Just to give some context to what I am
doing, I just created
2008 Dec 21
1
flash fails to work on Los Angeles Times website - fix
Hello,
I have a 32-bit install of C5.2 on my Intel Centrino Laptop (2005).
The Adobe flash plugin works fine in Firefox in all cases except on the Los Angeles Times website http://www.latimes.com.
I was baffled by this for a few months, since it works on another 32-bit C5.2 box. When I realized that the only real difference was that the laptop had no LAMP install, and both had the same elaborate
2006 Aug 07
4
Unit testing diffculty
ok, let me show you my "products" fixtures file:
ram:
id: 1
title: RAM
description: ECC RAM Registered, 512MB
image_url: images/test.jpg
price: 29.95
date_available: 2005-01-25 00:00:00
busted_arsehole:
id: 2
title: Busted Arsehole
description: I have an arsehole, it is-e busted
image_url: images/test.jpg
price: 999.95
2007 Oct 07
10
Rails to English
I am currently using the book "Agile Web Development With
Rails" (2005). I am working on a fully function web application that
has a shopping cart.
The web page displays this,
ActiveRecord::StatementInvalid in AdminController#create
Mysql::Error: #23000Column ''date_available'' cannot be null: INSERT
INTO products (`image_url`, `date_available`, `price`, `title`,
2006 Jul 02
5
Pretty URLs -> Routes
Hi
I am having issues with getting my pretty urls to work.
routes.rb:
map.connect '':user'' , :controller => ''front'' ,
:action => ''list'' ,
:filter => ''user''
front_controller.rb:
def list
@advert_pages, @adverts = paginate :adverts, :per_page => 10
@user =
2006 Jan 17
5
file_column mangling URL
Hey,
I''ve gotten file_column to upload a file, drop it in the dynamic
directory, but I can''t display the image, the directories repeat
themselves:
My model:
class Person < ActiveRecord::Base
file_column :image_url
In my view:
<%= image_tag url_for_file_column(''person'', ''image_url'') %>
HTML generated is this:
<img
2006 Jan 10
3
multiple items on 1 column
Hello,
I am trying to put multiple items in one column and can''t seem to get
the syntax right.
These are images and the image url''s are being pulled from a database.
It seems that <tr></tr> is the trigger to go onto the next item.
Here is the code from the controller:
def list
@items = Item.find_all
end
Here is the code from list.rhtml file:
<%
2006 Jul 06
1
Form not inserting data into database
I have a form to register a user. The issue I am having is the fact that
it only populates login, hashed_password and created_at fields.
DB table:
create table users (
id int not null auto_increment,
login varchar(100) default null,
hashed_password char(40) default null,
email varchar(255) default null,
salt varchar(255) default
2006 Mar 03
5
avoiding nil object error?
I''m a total Rails newbie and i''ve been struggling for hours today
with one (prolly very silly) problem:
I have a table portfolios that has many images:
class Portfolio < ActiveRecord::Base
has_many :images
end
class Image < ActiveRecord::Base
belongs_to :portfolios
end
In the controller i define a list of active portfolios:
@active_portfolios =
2006 Jan 19
4
validates_presence_of
I am just going through the book and I come across a problem with the
code in the app/models:
validates_format_of :image_url,
:with => %r{^http:.+\.(gif|jpg|png)$}i,
:message => "must be a URL for a GIF, JPG, or PNG image"
It seems to moan when it''s empty even though I removed :image_url from
validates_presence_of. How should I make it optional?
2005 Dec 23
5
Can''t get data from products into @order
I went throught the "agile web developemnt with rails" and Now I''m
trying to ''enhance'' the code with some extra options. When I go to
admin/shipping I want to include some data from the products table in
with the order info listed. I can''t seem to get this to work. in my
partial form I''m trying to add this:
<td