Displaying 20 results from an estimated 10000 matches similar to: "Authentication: is a guest a user or an "exception"?"
2010 Nov 30
4
Cucumber+Capybara rails 3 issue (Don't know where exactly)
When I''m executing cucumber tests, I noticed that sometimes rails app
(in test env.) getting several the same requests (GET or POST) usually
around 3, and it doesn''t render anything with empty HTTP status code.
Have anyone met something similar to that issue?
here is some example of log file:
Started POST "/account" for 127.0.0.1 at 2010-11-30 22:34:17 +0200
2005 Mar 01
0
has_and_belongs_to_many problem
I''m having a problem with a has_and_belongs_to_many (habtm)
association between two models with extra attributes. I''m writing a
comic book database, and each issue has many creators on it. Thing
is, some creators perform multiple duties. They may write one issue,
draw another, etc.
However, if I add a creator twice to an issue and try to delete it, it
removes both creators:
2006 Aug 16
4
Undefined method - what undefined method
I am doing a typical database list, but when I do
<% for m in @private_messages %> (Line 28) It tells me that the method
''each'' is undefined. What''s wrong, I did not call the method each....
Here''s the error:
Showing app/views/account/mail.rhtml where line #28 raised:
undefined method `each? for #<PrivateMessage:0x408bb830>
Extracted source
2006 Jun 07
1
Web Service: NoMethodError (missing attribute: featured) !?!?!?!?!
Hi all -
I have a Player model. The database looks like this:
+-------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| fname |
2006 Jul 14
3
Migration not updating fields
So I have this fairly basic migration bit of code
class AddCounterCache < ActiveRecord::Migration
def self.up
add_column ''products'', ''backlog_items_count'', :integer, :default =>
0
end
def self.down
remove_column ''products'', ''backlog_items_count''
end
end
What I want to do in that is automatically
2006 Jan 16
0
belongs_to with has_and_belongs_to_many
I''m having a problem with belongs_to and has_and_belongs_to_many.
Here''s a brief summary of the models involved:
class Member < ActiveRecord::Base
set_primary_key ''member_id''
has_and_belongs_to_many :projects, :join_table => ''projects__members''
has_many :projects, :foreign_key => ''created_by''
end
class
2006 Mar 24
1
Problems with before_validation
Hi all
My visitors can create party organisator profiles, and I want assign
them as the creators (the field creator_id in the organisators table
references a member in the members table).
To do that I tried it with before_validation:
def before_validation
creator = Member.find 1
end
Sadly, this does not work. The validation
validates_presence_of :creator_id
Still tells me, that
2006 Jul 24
0
Mongrel + BackgrounDRb + File Column = Upload Progress Bar?
Hi there,
I''ve been digging around trying to find some information (mostly examples)
on how one would handle a progress bar upload using BackgrounDRb and File
Column. I did read http://backgroundrb.rubyforge.org/ and Ezra''s blog of
course, but I still have a few questions.
I made a simple upload form (as a test) that is submitted to the
"upload_song" action.
def
2005 Nov 22
11
Building a conditions clause (for find) of multiple optional params?
I want to be able to find items according to various params - category_id, member_id, type_id,
rating, etc. What I have now is something like:
if(@params[''category_id''])
@items=Item.find(:all, :conditions=>["category_id=?", @params[''category_id''])
elsif(@params[''category_id''] and @params[''member_id''])
2006 Feb 17
2
validate uniqueness of two fields
I have Proposals and Members and Members can vote for a proposal only once.
So, I have "Vote belongs_to :member, :proposal", but to make sure a member only votes
once, I want to make sure that there isn''t a vote in the db with that member_id and
proposal_id. I can just put the appropriate find in a vote.valid? but I wanted to make
sure I wasn''t missing a nice rails
2006 Jun 27
2
how to use scope with acts_as_list
i am working on a task management system for the company i work for. i
just got the rails cookbook and am trying to use the section on creating
a drag and drop sortable list.
the tricky part is that my Task model references the User model in two
different spots. i have one field for the creator of the task and
another for the assignee. so in my Task model i have the following code:
class
2006 Jul 30
1
Bug? find_by_id(nil) returns object just created
Tried to submit a ticket in Trac, but it reported an error...
Doing a Model.find_by_id(nil) after creating an object of type Model returns
that object -- and the next time, returns nil. It should always return nil.
For example,
Step 1. Create an object:
>> Foo.create(:name => "bar")
=> #<Foo:0x2aaaac3ade20 @new_record=false,
2006 Jul 13
2
find_by_id(nil) does not always return nil
I have a model named User. When running this application from the
console I can call User.find_by_id(nil) and it returns nil. When running
this application during testing or through WEBrick or Mongrel calling
User.find_by_id(nil) returns the newest record in the database. But it
only does this the first time you call it with nil. The second time you
call User.find_by_id(nil) it returns nil.
2006 Jun 15
2
AJAX form inside table - error
Hello,
I need to put an AJAX, form such that it is inside a table, and spans across
few rows.
But, what I am noticing is that, while submitting the form, the data in the
fields is not submitted.
If I move the form outside the table or inside a cell, things work OK, but not
when the form is inside the table and spans few rows. This problem is only
with AJAX forms, regular forms work perfect. I
2006 Jan 29
9
Specify options with habtm
Hi all
I have the following models:
class member
has_and_belongs_to_many :disc_jockeys
end
class disc_jockey
has_and_belongs_to_many :members
end
The relation table is called disc_jockeys_members and has the following
fields:
disc_jockeys_members(disc_jockey_id, member_id, status)
So far, the field status can have values like valid, invalid, locked
etc., but it is not regarded yet by
2006 Jun 27
3
find_by_id vs. find in postback action
I''m playing around with the Postback action recipe listed in the recipes
book.
Here is the default code given:
def edit
@recipe = Recipe.find_by_id(params[:id]) || Recipe.new
if request.post?
@recipe.attributes = params[:recipe]
redirect_to :main_url and return if @recipe.save
end
end
Here is what my code sort of ended up looking like, altho i''ve ripped it
apart
2006 Jul 24
4
Mongrel + BackgrounDRb + File Column = Upload Progress Bar?
Hi there,
I''ve been digging around trying to find some information (mostly examples)
on how one would handle a progress bar upload using BackgrounDRb and File
Column. I did read http://backgroundrb.rubyforge.org/ and Ezra''s blog of
course, but I still have a few questions.
I made a simple upload form (as a test) that is submitted to the
"upload_song" action.
def
2007 Mar 07
4
Strange Problem With Unwanted, Transient Caching
Hello,
I hope somebody can explain to me what''s going on here because I''m
baffled!
In a controller''s action I want to create a new order for a
customer. Because I post back to the same action (not RESTful I
know, but that''s for another day) I use code like this:
def edit
@order = Order.find_by_id(params[:id]) || Order.new
...
end
I
2007 Dec 04
1
spec''ing shared controller methods
I want to isolate and spec methods that are shared by controllers,
and live in application.rb.
Whereas I usually also provide examples in individual controllers
that use these methods, not necessarily all the edge cases and I''d
like to isolate the examples.
This is the approach I''m taking (thanks to bryanl for suggestions and
http://pastie.caboo.se/123626). WDYT?
This
2006 Apr 01
0
Okay, what gives? find_by_id is failing.
This has the look of a "just don''t quite get it yet" problem. I am
using the ActiveRecord.find_by_id method to identify the parent object
(Quiz) to tie to the child object (Question) at create time.
Here is the stdout log:
127.0.0.1 - - [31/Mar/2006:22:43:22 CST] "GET /question/new?
parent_quiz=ff2d7022-be0a-11da-9f01-00400506faf5 HTTP/1.1" 200 806