Displaying 20 results from an estimated 200 matches similar to: "Making attachment_fu polymorphic"
2008 Sep 29
1
has_one :through with :source. How to alias association?
Hi to everyone,
I have the following models:
class Attachment < ActiveRecord::Base
has_attachment :content_type => [:image, ''application/pdf''],
:max_size => 3.megabytes,
:path_prefix => ''../private/attachments'',
:storage => :file_system,
:processor => :rmagick,
2006 Apr 22
9
one to many question
1. A category has parent categories.
2. A product is in many categories and a category has many products.
3. Products and category both have images in the same image table. ie. a
product and / or category could have multiple images.<=== my question is
related to this
So among other things I presume I have to do the following:
class Category < ActiveRecord:Base
#...
2007 Aug 22
8
How to spec an attachment_fu model
First off, I''m not trying to spec attachment_fu, I know it''s been tested.
But, I added some code to that model that I do need to test. Basically,
I need to somehow fulfill the "uploaded_data" property so I can actually
run my tests(otherwise they fail because of validations). The
"uploaded_data" field is what would grab the multipart data from form.
Here
2007 Oct 09
5
Backticks wrapping SQL values in polymorphic associations...
Hopefully the subject line didn''t scare you. That said...
I have a simple polymorphic relationship (is that possible?):
class Part
has_many :attachments, :as => :attachable
end
class Attachment
belongs_to :attachable, :polymorphic => true
end
Calling Part.find(:first).attachments yields this SQL error:
ActiveRecord::StatementInvalid:
Mysql::Error: Unknown column
2006 Feb 10
3
[Req] polymorphic associations howto
Hi people,
I''m looking into polymorphic associations as a way to cleanup some
messy parts of my code. I think they will allow me to do exectly what
I need, but since there''s little to none written on this subject, I''d be
delighted if someone could shed some light on this. Especially what
the different options and needed table structures need to be.
Thanks,
-
2009 Jul 30
4
attachment_fu + :path_prefix
Hello friends,
I have a query like I am using a attchment_fu to store images.
But the i don''t want to store to the default path let say :path_prefix =>
''public/uploads'' i want a dyname path for e.g :path_prefix => ''public/#{
current_user.id}'', So just wanted to know how can i say images to the
dynamic location.
Regards
Abhishek Shukla
2007 Nov 02
5
RSpec, RESTful nested routes and :path_prefix
Dear list,
In the app we are making we have a rout something like this:
map.resources :projects do |projects|
projects.resources :pages, :controller
=>"Wiki::Pages", :path_prefix => "/projects/:project_id/
wiki", :name_prefix => "project_wiki_"
end
But I can''t get RSpec(I''m very new to it) to accept this. It keeps
throwing errors:
2007 Dec 14
2
Rails 2.0 map.namespace and path_prefix
Hi!
I''m trying set up new routing in rails 2.0 and have 1 problem
map.namespace :admin do |admin|
admin.resources :permissions, :path_prefix => ''/:lang''
end
i want have addres like this:
http://site.com/en/admin/permissions
also i tested:
map.with_options :path_prefix => ''/:lang'' do |lang|
lang.namespace :admin do |admin|
2009 Apr 21
3
attachment_fu giving problem on production
Hello friends,
I have configured attachment_f. It''s working fine on Local(development)
system but giving problem on production. Basically on production the
attachment_fu is not able to generate thumbnail image it saving the original
size image. Below is the configuration.
has_attachment :content_type => :image,
:storage => :file_system,
:max_size
2007 May 07
1
attachment_fu seems to be searching the wrong location for my images
I just installed attachment_fu and for some reason, it seems to be
looking in the wrong location for my images.
I have a Product model that belongs to a photo model. the photo model
has the attachment_fu installed and configured like so:
class Photo < ActiveRecord::Base
has_attachment :content_type => :image, #Allow
standard image formats
:path_prefix
2012 Oct 06
1
how to scope the /auth/:provider/callback , using OmniAuth for users and members
I have two separate groups of people authenticated w Devise , but in
this case I cannot used the Devise embedded OmniAuth support. So i am
using directly the OmniAuth gem.
Initialized w :
Rails.configuration.middleware.use OmniAuth::Builder do
..provider :twitter,
..
end
It''s running fine , but I have an issue with the callback route
mapping :
I tried
match
2006 Sep 22
2
possible to create polymorphic relationship with STI models?
I would like to associate a ‘product’ model with 3 models inherited from
‘image’: part, action and accessory.
I have it working with Has_many :through relating products to images
through attachments, I then have to determine the ‘type’ of the STI
extension. This means i have to go product.images. While this is ok, i
can see it getting tricky when i want to go products.images <<
2008 Jan 29
4
map.resources for controllers in a module
Hello-
I''m giving RESTful development a shot. I''m running into some difficulty
with controller I have grouped into modules. Specifically, I have a
"admin" module with a "user" controller (created with "generate
controller admin/user"). I managed to get map.resources wired up with
this code:
map.resources Admin::User, :path_prefix =>
2007 Oct 28
2
failing test with nested controller routes
I have googled and browsed through spec-users archives, but didn''t
find anything different.
I used rspec scaffold command to generate a mvc for groups, I used
nested controller so I could have a separate interface for admin.
the specs are the same as generated, so I won''t post the whole thing.
I did put the nested routes names on the calls to the name routes:
it
2007 Sep 25
2
attachment_fu default path
Hi all. I''ve done a little google search, but doesn''t find anything
(with "attachment_fu default path") that could help me in changing
attachment_fu''s default path.
My model:
[audio.rb]
has_attachment :max_size => 20.megabytes
has_attachment :content_type => "audio/mpeg"
has_attachment :storage => :file_system
2006 Aug 14
1
Rest, routes, path_prefix and default params
I am trying to use routes with default params to have routes
''/mycompany/departments''
and
''/companies/1/departments''
mean the same thing (both restful routes).
When I set up the files as below, I get an error of
''Couldn''t find Company without an ID''
and my log file shows the following ..
Processing DepartmentsController#index (for
2009 Nov 10
10
Un-recognised routes that do exist, using namespaces & subdomain checking
I''m getting really cheesed off with RSpec not matching some of my
routes when controller testing when I have subdomain checking
(courtesy of subdomain-fu) on namespaces. These routes appear in the
rake routes output, and work fine via HTTP requests .
The really annoying thing is it''s working fine for routes that aren''t
at the root of the namespace.
E.g. say I have
2011 Mar 06
1
PXELINUX Debugging Output
I am sending a patch that makes the debugging output of PXELINUX slightly
more concise, without (intentionally) affecting its completeness at all.
Additionally, I am proposing that the debugging output of PXELINUX --
specifically the messages that appear after the copyright statement, but
before the menu is loaded -- only be shown in response to keyboard input
(such as holding Shift or Alt, or
2006 Jul 19
2
SimplyRestful bug?
Hi I have my routes set up like this:
map.resource :contact, :path_prefix => "/employers/:employer_id"
so now when I view all contacts for an employer I go to:
/employers/1/contacts
That works. On that page, there''s a problem with the routes:
new_contact_url translates to: /employers/1/contacts/new ... so that
works.
But, contact_url(@contact) gives me
2006 Aug 28
1
Nested Resources failing..?
Hey I was wondering if anyone else was having problems with nested
RESTful routes such as:
map.resources :posts do |posts|
posts.resources :comments
end
?? It is not working for me, I have to declare it in the old prefix
way, and it works fine...
map.resource :comments, :path_prefix => ''/posts/:post_id''
Just wondering if others are having the same trouble before I do