Hello, I have the next:
class Post ActiveRecord::Base
has_many :image, :dependent = :destroy
accepts_nested_attributes_for :image, :allow_destroy = true, :limit
= 4
end
class Image ActiveRecord::Base
belongs_to :Post
... paperclip settings ...
end
And the form view for the post is:
On 28 jun, 06:52, Dheeraj Kumar a.dheeraj.ku...@gmail.com wrote:
Usehttp://blueimp.netjquery-based ajax uploader.
Thanks Dheeraj. This seems all I needed.
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send email
I have been investigating and I have finded Uploadify. What about it
compared to Jquery Ajax Uploader?
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe
Hi, now I have working a form for upload images. I'm using
'nested_form', 'paperclip' and 'aws-s3' for storage. All works fine
but I would get better. The problem is that the user select the images
that want upload but until the user do submit the images is not
uploading. It is not nice, because
I'm trying to use select('DISTINCT *') but it doesn't work. Sure, de
INNER JOIN between Post and Tagging result of table that all rows are
distinct. If we supost the next:
Posts Table
ID TITLE
1Foo
2FooFaa
TAGGINGS Table
ID POST_ID TAG_ID
1 11
1
Haven't tried it, but maybe grouping on posts.id would do the right
thing?
--Matt Jones
Hello Matt, thanks for the answer. I've try it and it works fine
except when you call to count method later. I've solve it well:
scope :finded, lambda {|id| where(:id = id)}
scope :tagged, lambda
Great Valery! I've solved it.
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to
Hello,
I've a usually structure with Post has_many Tags through Taggings. All
works well and clean. But I'm having problems with the next scope on
Post:
scope :tagged, lambda {|tag_id| joins(:taggings).where(:taggings =
{:tag_id = tag_id}) }
All works fine for call of only one Tag like:
Hello, I have a model like this:
class Car ActiveRecord::Base
def color(c)
where(color = ?,c)
end
end
Suppose that I want to show the red and blue cars. I could do
something like this:
@cars = Car.color('blue') + Car.color('red')
The problem I'm finding is that now, @cars is an array
Thanks cpr. It isn't work for multiple select control but It's okey
for a classic select.
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this
Other solution is change the params hash for setup like
accepts_nested_attributes_for is expecting. I don't know which is the
best solution for do it. In short, I want to create multiple nested
objects by selecting from a list.
--
You received this message because you are subscribed to the
class Comment
belongs_to :post, :counter_cache = true
end
class Post
has_many :comments
end
Thanks so much Kendall, nice solution.
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send email to
Hello, I'm triying to set a form but I'm having problems.These are my
models:
class Post ActiveRecord::Base
has_many :taggings, :dependent = :destroy
has_many :tags, :through = :taggings
accepts_nested_attributes_for :taggings, :limit = 3
end
class Tag ActiveRecord::Base
has_many
I would advise against a strategy that could ever be ambiguous, even
if it looks unlikely at the moment. It would likely bite you at some
point in the future, or even worse the developer who comes hereafter,
can you imagine what he/she would say about you when he realised the
problem and
Hello, I have a Post that has_many Comments. I have the next scopes:
scope :valid, where('created_at = ?', 2.months.ago)
scope :expired, where('created_at ?', 2.months.ago)
Now, I would have a scope named :commented that return all the Post
that have more than 0 Comments but I don't know how do
Thanks for the answer.
But then what happens with:
- example.com/pink/cadillac ?
In the controller would have to check that pink is a Color and
cadillac is a Brand. Problem if some day there is a Brand with name of
Color. I don't know if it's worth wasting time on it. The classic way
sould
Any help?
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscr...@googlegroups.com.
For more
Hello, I'm trying to set my routes.rb. I have Car that belongs to
Color and Brand. I want to build a clear url searcher without visible
variables. It's working for me this:
resources :Cars
match 'color/:color' = 'cars#index'
match 'brand/:brand' = 'cars#index'
match 'brand/:brand/color/:color' =
For give a example, the url I hope to have is something like that:
- example.com/brand/ford/color/red
- example.com/brand/ford
- example.com/color/red
The idea is to have the same that:
- example.com/cars?brand=fordcolor=red
But really, the user already knows that Ford is a brand and Red is a
19 matches
Mail list logo