Hi all,
I have an error which said undefined method culture_id
but in the DB, it contains culture_id in user table..
Picture.where(:album_id = :album, :culture_id =
User.culture_id).first
Please help to solve this problem...
THanks
--
You received this message because you are subscribed to
I think the problem is that you dont have :culture_id = in the
Picture model. Is that right?
On Tue, Jun 14, 2011 at 7:19 AM, Yennie joanne0...@gmail.com wrote:
Hi all,
I have an error which said undefined method culture_id
but in the DB, it contains culture_id in user table..
I have culture_id in Picture Model as well
On Tue, Jun 14, 2011 at 10:33 AM, Noel wwydi...@gmail.com wrote:
I think the problem is that you dont have :culture_id = in the
Picture model. Is that right?
On Tue, Jun 14, 2011 at 7:19 AM, Yennie joanne0...@gmail.com wrote:
Hi all,
I have
The problem is that you're using User.culture_id
The class User doesn't have a method called culture_id
You probably want to use a user instance instead of the class:
user_instance = User.find(1)
Picture.where(:album_id = :album, :culture_id =
user_instance.culture_id).first
--
You received
user_instance = User.find(1)
@pic = Picture.where(:album_id = :album, :culture_id =
user_instance.culture_id).
first
ya, it work but it return nil.. and i cannot take value from Picture model
it causes me undefined method image when i call @pic.image
On Tue, Jun 14, 2011 at 11:19 AM, Tim
I'm not sure what you're trying to say.
When you use culture_id in the where clause, it needs to have a value.
This value can come from any number of places such as a user instance, query
parameter, or even be hard coded.
--
You received this message because you are subscribed to the Google
i did try the code from above on rails console. it is return nil...
so can you explain it please
On Tue, Jun 14, 2011 at 12:01 PM, Tim Shaffer timshaf...@me.com wrote:
I'm not sure what you're trying to say.
When you use culture_id in the where clause, it needs to have a value.
This value
I cannot explain it. You're not providing enough information about your
environment and any error messages you may or may not be receiving.
Which part returns nil?
Did you run this on the command line?
user_instance = User.find(1)
Did it return nil? If so, you probably don't have a user by
I run those code in terminal
user_instance = User.find(1)
= it shows me all the data in the User table
and then i run
Picture.where(:album_id = :album, :culture_id =
user_instance.culture_id).first
=nil
On Tue, Jun 14, 2011 at 2:15 PM, Tim Shaffer timshaf...@me.com wrote:
I cannot
does
user_instance.culture_id
return something?
try doing the Picture query by putting in the culture_id yourself.
maybe you dont have a picture with that culture_id
Picture.where(:album_id = :album, :culture_id =3).first
On Tue, Jun 14, 2011 at 11:26 AM, joanne ta joanne0...@gmail.com wrote:
Also double check that there is a picture that has an album_id of :album
Kind of weird that you're using a symbol there. Are you sure you don't mean
to be using a variable instead?
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To view
11 matches
Mail list logo