Displaying 20 results from an estimated 11000 matches similar to: "Object isn''t being saved when called through association"
2006 Apr 11
0
Trying to come up with a nice DSL, but having some problems
I have three models in this small game I''m working on - the Game,
Players, and Turns. A Player should be able to rescue another Player
on any given turn. So it looks like this:
class Game
has_many :players
has_many :turns
def rescue_player(p)
t = turns.last
t.rescued = p
t.save
end
end
class Turn
belongs_to :rescued, :foreign_key =>
2005 Oct 16
13
More than one parameter with link_to_remote
Hi all,
I''m trying to pass more than one parameters using link_to_remote, but I''m
getting a behaviour that seems quite strange to me. Here''s the code:
link_to_remote ''some text'',
:update => ''form'',
:method => ''get'',
:url => { :action =>
2006 Aug 11
9
Getting Really Started with Rails - Tutorial styled Slides Available
For those that missed out joining the amazing turnout of ~70 people here in
Vancouver for the mini-workshop I did on the 27th last month, I am making
available the 30 slides I used for the presentation.
The slides were used in conjunction with me demonstrating it via command
line. Alot was learned by both attendees, and quite possibly even more so by
myself while teaching the material.
I created
2006 Jan 06
7
Question
All,
I am looking to write an ecommerce application and debating using
rails or struts. Any advice as to which path to follow.
2006 Aug 04
9
Mongril or Lighthttttp? Yes
I was writing my blob at http://railsblob.blogspot.com/ which is for new
people who are new to Rubby and I was learning if Mongril or
Lighthttttp? or Web Rick is better for me. Have you any advice. Thanks?
Rails Blobber
--
Posted via http://www.ruby-forum.com/.
2006 Feb 14
22
Teaching Models to Render Themselves in the Controller
I am trying to teach my models how to render themselves, i.e.
<%= my_model_object.render() %>
Let me explain my reasoning and proposed method before this gets shot
down as anti-MVC.
Let''s say I am writing a contact-management application. I have a
class Contact. I will need to display this class all over the
application. My first choice is to use a partial.
Now I can
2006 Jun 30
2
Development of RailsCron
Hi,
Is the development of Rails Cron still active? most of the blog articles
about it are unavailable and it hasn''t been updated for a long time.
--
Abdur-Rahman Advany
http://blog.railsdevelopment.com/
2006 Mar 09
13
Apache or lighttp for Ror/2003server?
160,000 pages
99% static, only minor stuff done in rail (search, contact us, etc.)
windows server 2003
Ror 1.0
Currently 30K Hits /day on IIS.
Apache or Lighttp? Fast_CGI seems kinda slow with a 2003/Apache
configuration.
The only thing I''ll get rid of for sure is IIS.
-Cedric
--
Posted via http://www.ruby-forum.com/.
2006 Mar 24
3
Tweaking Rails to Reduce RAM Usage
Is there a way to tweak rails 1.0 or 1.1-rc1 to use less RAM?
I''m using a VPS (Linux UML) with < 160 MB RAM and would like to explore
ways to make rails run more efficiently under such constraints.
Are there articles/tips about this or do I need to look into this from
scratch?
--
Posted via http://www.ruby-forum.com/.
2007 May 21
4
Just upgraded to 1.0.0, should render_text isn''t working for me
I finally got around to upgrading from 0.8.2 (!!). I had a spec which
looked like
specify "should render abc123" do
controller.should_render :text => "abc123"
get :key
end
With 1.0.0, the new spec is
it "should render abc123" do
get :key
response.should render_text("abc123")
end
However it doesn''t work, giving me the error:
undefined
2006 Jan 15
9
DHH''s dislike of high level components
On 1/5/06, David Heinemeier Hansson wrote:
>
> The lure of components is directly proportional with the pain of development.
I''m not trying to be abrasive in any way but I''m curious if this
attitude is related to the number of rails apps David maintains. No I
don''t know how many login systems David maintains. I can understand
avoiding components if a person only
2008 Feb 13
5
Example controller spec no worky?
I''m trying to spec a dead simple "show non-existent record should render
404" case, but it seems the RecordNotFound exception is making it
impossible for some reason.
#controller
def show
@event = Event.find(params[:id])
end
#spec - pretty much straight from the rspec site
before do
Event.stub!(:find)
get :show, :id => ''broken''
end
#
2006 Mar 04
16
Unacceptibly slow.
I currently have a fairly simple Rails application running on FreeBSD
under Apache 1.3 and normal CGI, and the performance I''m getting is
alarmingly poor. I realize CGI or WebBrick are quite a bit slower than
FastCGI, and I''ll probably use one of those instead when I have the
time. However, I''m just curious if CGI is really supposed to be that
slow, or if
2006 Mar 29
7
Dreamhost upgraded 1.1 - app doesn''t work
Does anyone know how long it will be until Dreamhost get''s the Rails 1.1
install running correctly?
My site has been down since last night at about 7:00 pm (I think).
It''s annoying, and are a lot of others having this problem too?
Thanks.
--
Posted via http://www.ruby-forum.com/.
2006 Jun 07
6
I want to stick my models in a module
I''ve got enough models now that I''d like to separate them into
modules. For example, I have the class Player that I want to stick in
the Trainer module. I''ve changed the definition to
class Trainer::Player
I''ve created a models/trainer dir, test/unit/trainer, and
test/fixtures/trainer. Change the PlayerTest class to be
Trainer::PlayerTest. I get the
2007 May 21
4
Spec''ing redirect with arbitrary parameters
I''ve got the following expectation:
response.should redirect_to(:action => "new", :video_id => "1",
:process_id => "2", :origin_id => "3")
that fails with this error message:
expected redirect to {:video_id=>"1", :process_id=>"2",
:origin_id=>"3", :action=>"new"}, got redirect to
2006 Mar 19
4
Trouble with composed_of
I''m trying to use composed_of within my model. I have a field in my
database named ''card1'', which is simply a string. I have this in my
model
class Player < ActiveRecord::Base
composed_of :card1, :class_name => ''Card''
end
class Card
attr_reader :value, :suit
def initialize(s)
@value = s[0].chr
@suit = s[1].chr
end
end
The
2007 Oct 05
7
Easy AR association stubbing
I''ve added a method to the mock class that makes it pretty easy to
stub associations in rails. I''ve been using it for awhile and it seems
to cut down on a lot of setup code for the controller and model specs
that use associations.
#before
@person = mock_model(Person)
posts = mock(''post_proxy'')
posts.stub!(:build).and_return(mock_model(Post, :save => true))
2006 Jan 19
12
Switchtower isn''t restarting lighttpd
I''ve got switchtower set up, and it seems to work fine except for one
problem: It doesn''t successfully restart lighttpd. I have the
following task in my deploy.rb file:
desc "Restart the web server"
task :restart, :roles => :app do
sudo "/usr/local/etc/rc.d/lighttpd.sh restart"
end
This is on a FreeBSD system, so it''s using the rc script to
2006 Mar 30
7
Enterprise rails app with - about 100 tables
I''ve just started creating a web application with approx. 100 tables.
Possibly more. Oracle is the DB. There exists a legacy schema I that i
will use some of.
So far i have created a small bit of the app, approx 10 tables.
Im using webrick on my local machine. The Oracle DB is on its own
server.
My boss has noticed that its not really that zippy, there is a small
delay between