Displaying 12 results from an estimated 12 matches similar to: "RSpec''ing model association callbacks"
2008 Jan 11
5
Missing methods
We have a custom implementation of the Mother Object idea. It''s inside
of a module, basically like this:
module Factory
%w(account friendship person invitation message asset email_address
birth).each do |klass|
eval <<-EOF
def self.create_#{klass}(attributes = {})
default_attributes = valid_#{klass}_attributes
#{klass.camelize}.create!
2008 Jul 17
2
Final Opinion :: Need final opinions on the best way to handle arrays in forms
Hi There, rails noob just trying to suss a few things out.
So I have 2 tables. 1 called Posts and the other called comments. On
one page I need to be able to edit both the information about the post
and the attributes of each comment for that post. So here is what the
array might look like:
(Inside the params hash)
"post" => [
{"id"=>28, "title" =>
2006 Aug 04
2
Newbie Question: fom_tag_remote return HTML
Hi Everyone,
I am still only 1 week old on Rails and I am trying to implement an
AJAXy "Add comment" sheet. On the post for a new comment, I want to
use form_tag_remote. I would like to use a partial that I want to
render for the newly posted comment once the Submit happens. What is
the syntax to say, render a partial once the submit happens?
Thanks,
Vinod
2006 Jun 15
6
Newbie''s problem with a nil object he didn''t expect!
Dear Rubyists/Rails gurus,
Though I''ve successfully completed the various Rails tutorials online
and the Depot application from the Agile Web Development with Rails
book, I''m still pretty much a Ruby/Rails newbie. I''m trying to learn by
writing my own simple blogging application, but I''ve run into a problem
that has had me scratching my head for a few days now.
2010 Aug 18
6
Once I added this HABTM, one of my 'through' relationships, on a non-habtm model, seems to have broke?
I''m a rails newb and have been Googling about this, but I''m still stumped.
Not showing everything here, but basically it should be a pretty common
setup so I''m sure others know what I''m doing wrong.
- A meter can belong to many meter_groups
- A meter_group can have many meters.
- A user can ''subscribe'' to viewing a meter_group (Subscription)
2007 Sep 26
10
How do I best setup data for Story Runner?
Just started looking at the Story Runner integration, and am
converting a few Rails integration tests to get a feel for it.
My integration tests relied on fixtures, and since my models have a
significant amount of validation (and hence need valid data unless I
save without validation), this has made setup easy.
With stories however, I''m wondering what the recommended approach is.
2006 Mar 24
0
Connecting to SQL server on Mac OS X
I''ve had this problem before on FreeBSD - I fixed it (or worked
around it) somehow but I can''t remember how. Also it''s off the
Google radar but I can''t believe I''m the only person to experience it
I''ve installed FreeTDS and unixODBC from DarwinPorts, along with rb-
odbc and rb-dbi. I can connect to my SQL Server from tsql, but
2008 Mar 12
3
undefined method `each' for #<Usrecart:0x46d1678>
I have the an error such as undefined method ''each''
pls can any one find the error from the code given below
<center><%=@b%></center>
<center><h2>WELCOME IN YOUR PROFILE</h2>
<%@usercart=Usrecart.find_by_user_id(@b)%>
<%if @usercart.blank?%>
<br>
<br>
<br>
<br>
<h2>THERE IS NO
2007 Dec 28
2
Arity?
Hello,
First off, nice improvements hemant! Thanks for all the hard work. I
just whipped up a new worker for a scheduled job that sends digest
emails. Very smooth.
However, moving some of my old backgroundrb into new backgroundrb
isn''t going quite as smoothly. I have a import worker that takes a
number of parameters and then is started dynamically. Here''s the a
2006 Feb 02
0
What is best way to show only records belonging to loggeduser?
When I do this, I store the after a successful login. user''s id in
session. My controller actions pass that id into the find method
@tasks = Task.find_all_by_user_id(session[:user_id])
The session would have to be hacked in order for that to be broken. It''s
been secure enough for me.
-----Original Message-----
From: rails-bounces@lists.rubyonrails.org
2012 Oct 26
0
Routing error in rails
In my controller I have
def update_project_dates
p "It is end date....."
@user=User.find(params[:user])
@projects=Project.find_all_by_user_id(@user)
end
In the view page (only some part of the code is copied and pasted)
eventDrop: function()
{
$.ajax({
url:''/update_project_dates/'',
2007 Dec 06
43
Mocks? Really?
OK, so i''ve played a bit with mocks and mock_models in controller and
view tests and i have a question. Is this statement really correct:
"We highly recommend that you exploit the mock framework here rather
than providing real model objects in order to keep the view specs
isolated from changes to your models."
(http://rspec.rubyforge.org/documentation/rails/writing/views.html