I have a model (accessed restfully) named TranscoderQueue, it''s name
is overridden to ''TransocderQueue'' so it is accessed as
''/
transocder_queue'' as opposed to ''/transocder_qeueus''.
class TranscoderQueue < ActiveRecord::Base
belongs_to :campaign, :class_name => "Campaign", :foreign_key
=>
"campaign_id"
set_table_name "transcoder_queue" # overriding rails conventions
validates_presence_of :campaign_id, :on => :create
end
Now, when I try to use the active resource lib to interface my API, it
defaults to the rails pluralized name, ''transcoder_queues'' --
obviously this fails with 404. How can I set active resource to obey
the overridden table name I set.
Alex
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
For posterity, the solution:
class TranscoderQueue < Base
set_collection_name ''transcoder_queue''
end
On Dec 18, 12:48 pm, eggie5
<egg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I have a model (accessed restfully) named TranscoderQueue, it''s
name
> is overridden to ''TransocderQueue'' so it is accessed as
''/
> transocder_queue'' as opposed to
''/transocder_qeueus''.
>
> class TranscoderQueue < ActiveRecord::Base
> belongs_to :campaign, :class_name => "Campaign",
:foreign_key =>
> "campaign_id"
> set_table_name "transcoder_queue" # overriding rails
conventions
> validates_presence_of :campaign_id, :on => :create
> end
>
> Now, when I try to use the active resource lib to interface my API, it
> defaults to the rails pluralized name,
''transcoder_queues'' --
> obviously this fails with 404. How can I set active resource to obey
> the overridden table name I set.
>
> Alex
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Documented here: http://plastik.us/blog/de-pluralizing-your-resources On Dec 18, 12:48 pm, eggie5 <egg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a model (accessed restfully) named TranscoderQueue, it''s name > is overridden to ''TransocderQueue'' so it is accessed as ''/ > transocder_queue'' as opposed to ''/transocder_qeueus''. > > class TranscoderQueue < ActiveRecord::Base > belongs_to :campaign, :class_name => "Campaign", :foreign_key => > "campaign_id" > set_table_name "transcoder_queue" # overriding rails conventions > validates_presence_of :campaign_id, :on => :create > end > > Now, when I try to use the active resource lib to interface my API, it > defaults to the rails pluralized name, ''transcoder_queues'' -- > obviously this fails with 404. How can I set active resource to obey > the overridden table name I set. > > Alex--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---