Displaying 20 results from an estimated 4000 matches similar to: "STI and :through, not working?"
2010 Oct 11
12
Need advice on controller / view
Need some advice. I''ve got two modules: artists and paintings.
In my home page, I''ve got a 2nd page that says "Browse paintings",
which displays ALL paintings of ALL artists. This is being rendered by
paintings#index.
In another page, I should show all paintings of a specific artist
ONLY. Meaning, paintings from ONE artist. I cant use paintings#index
for this anymore
2010 Oct 01
20
Paperclip not executing FFMPEG properly
Im using a customs processor to run ffmpeg on a video to create a
thumbnail.
So far so good. Except when I do:
cmd = "-i #{@file.path} -f flv -s 320x240 ~/Downloads/foobar/q.flv"
success = Paperclip.run(''ffmpeg'', cmd)
Console is reporting:
ffmpeg ''-i /var/folders/uL/uL0bYOOZEZaJH5E+BmDJVE+++TI/-Tmp-/stream,
16824,1.mpeg -f flv -s 320x240
2010 Sep 08
4
OpenSSL
Hello anyone used OpenSSL before?
Why do we need to pay for expensive SSL certs when there is OpenSSL
which is provided free? Is there a difference?
I''ve got an ecommerce website, and wondering if OpenSSL is enough?
Your thoughts will be appreciated
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this
2010 Oct 18
5
How to create a "like" button
Ive got a like and video model.
On a Video page, Users can click a link ("like") button which will
allow them to like a particular video.
Since my like button/image comes in the form of a link and not an
actual html form. How should this be implemented? Do I need to specify
a ":method => puts" in my link_to tag helper?
What are your thoughts?
--
You received this
2006 May 28
7
Self-referential has_many :through relationship
Hi,
I have a self-referential has_many :through relationship setup to
track relationships between users. Basically relationships are
modeled as a join table with an extra column ''relation''.
create table relationships (
user_id integer unsigned not null,
friend_id integer unsigned not null,
relation char(1) not null,
)
--- relations ---
f = friend
r = request to
2006 May 22
4
use join table in paginate
How come I allways immediately run into difficult stuff when I''m trying
some new programming language? Am I blind for the simplicity of
Ruby/Rail, which a see must be there? Anyway, don''t try and answer this
rhetoric question. I have got another one for you, seemingly difficult.
I''m struggling with a n:m relationship (in a database, that is) and its
join table.
2010 Oct 08
1
How to access virtual attributes in the model
I''ve got an artist form. In this form I''ve got attributes that do not
exist in the model that the form belongs to. However, I would like to
submit these values for later processing.
My virtual attributes in the form are:
<%= f.label :foobar %>
<%= f.text_field :foobar %>
In the artist model, I created a getter:
def foobar
end
When the form is
2010 Oct 15
1
Help with nested form: User and Artist
Artist is 1:1 with User. User has_one :artist
In my artist model, I have:
belongs_to :user
accepts_nested_attributes_for :user
However, in my artist _form, the name column from the user model does
not display. I am doing:
<% f.fields_for :user do |builder| %>
<p class="fields">
<%= builder.label :name %>
<%= builder.text_field :name %>
2006 Jun 23
2
polymorphic challenge
Hello All,
I have a little challenge and I am not sure if this is even possible
I am working on a dating/event site and few functionalities are similar
that I want to centralize them.
We have users which can have
- favorite users
- interest list
- blocked users
All these relations are like;
User <-> Relation <-> User
I was thinking I could have a class called Relation (with a
2010 Oct 14
7
undefined method?
I''m trying to learn rails as I go along, and having a bit of trouble.
There is an undefined method cropping that I don''t know why rails
thinks should be there.
Firstly, I''m using rails 3, ruby 1.9.2
I have a controller with an index action This part works fine, but i
am trying to add a comment form to the page that is rendered by that
index action.
Supposing my
2010 Nov 05
2
ActiveRecords queries: .where vs .find
I have a dataset, which contains a day column that I would like to
retrieve results on. Is there any reason why daily_stats.where(''day =
Date(?)'', dte).first returns and empty set,
daily_stats.find(:first, :conditions => [''date(day) = ?'', dte])
returns the correct data and daily_stats.where({:created_at =>
(date.midnight - 1.day)..date.midnight}).first
2010 Feb 11
3
Parameterized ActiveRecord Associations: Any such thing?
Hi list, how are ya?
So, my current project is just begging for the ability to have
parameterized associations in my ActiveRecord classes. Basically I
need something that is a cross between named scopes and standard
associations (has_many specifically).
I''m wondering if such a thing exists or, if not, if anyone else has an
elegant, equivalent solution?
Example:
class Sprocket <
2006 Aug 15
2
How to access attribute in a self-referential many-to-many relationship
Hello List,
I created a self-referential many-to-many relationship (as described
in the book Rails recipe #18), where I have a model that has
many-to-many relationships with itself. In this case, it''s person who
can become friends. The join table looks like this:
mysql> select * from friends_people;
+-----------+-----------+-----------+
| person_id | friend_id | confirmed |
2006 Nov 02
4
Still Having Problems With :through When Going To Same Table... Help... please :-(
I am having a problem with doing a :through that goes back to the same table.
The following are my two classes:
>>>>>
class User < ActiveRecord::Base
has_many :spanks
has_many :spanked, :through => :spanks, :source => :spanked_user
has_many :was_spanked_by, :through => :spanks, :source => :user
end
class Spank < ActiveRecord::Base
belongs_to :spanker,
2008 Oct 10
2
Add hash to serialized column
Hey guys,
I''m trying to merge a hash with another using the .merge! function.
class User < ActiveRecord::Base
serialize :preferences
end
This is what I end up with in the console:
>> u = User.find(1)
>> u.preferences.merge!{:test => 1}
SyntaxError: compile error
(irb):32: syntax error, unexpected tASSOC, expecting ''}''
u.preferences.merge!{:test
2011 Sep 26
0
Farmhouse in Provence
The Building Painting (http://www.micaroo.com/home-and-garden/wall-art/building-paintings.html) Farmhouse in Provence also known as Entrance Gate to a Farm with Haystacks was made in 1888 by Vincent van Gogh in Arles in Provence at the height of his career. Oil Paintings for sale (http://www.micaroo.com/home-and-garden/wall-art.html) Partially due to having been inspired by painter Adolphe
2006 Apr 20
7
checking date
Radrails created a field for date
<%= product.date_available.strftime("%y-%m-%d") %>
What does this mean?
Should the definition be date or datetime? I tried both and no results
Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060420/ed0cbb14/attachment.html
2006 Feb 17
1
validate() with has_many association
I''m creating a simple portfolio site for a painter. I have a painting
and an image model with following relationship:
Painting
has_many :images
Image
belongs_to :painting
On the edit screen the user can edit the Painting data as well as upload
pictures for a thumbnails and full size image. The Image model extracts
filename, width, and height from the uploaded file, saves those
2010 Jul 24
4
Wine 1.2-GIT: Compiler error in user32/painting.c
I got the following compiler error with Wine 1.2-GIT (up-to-date checkout):
Code:
make[1]: Entering directory `/home/quix0r/git/wine/dlls/user32'
ccache gcc -m32 -c -I. -I. -I../../include -I../../include -D__WINESRC__ -D_USER32_ -D_WINABLE_ -D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wstrict-prototypes -Wtype-limits -Wwrite-strings -Wpointer-arith -g
2006 Jan 29
8
Determining width and height of image files
I''m trying to figure out how to determine the width and height of images
that are uploaded through my app. Either from the posted data or the
file I save to disk. I''ve been searching around for info but no luck;
I''m completely at a loss. Any suggestions or pointers would be great.
Project background:
The site is an artists portfolio site. The images are thumbnails