Displaying 20 results from an estimated 38 matches for "article_id".
2007 Jul 19
3
Merb::Controller#url Usage
...rks differently
than I expected. I was wondering what the intended usage is.
For example:
Say I have
r.resources :articles do |article|
article.resources :article_attachments
end
irb(main):002:0> show_routes
[:articles, "/articles"]
[:article_attachments, "/articles/:article_id/article_attachments"]
[:article_attachment, "/articles/:article_id/article_attachments/:id"]
[:edit_article_attachment, "/articles/:article_id/article_attachments/:id/edit"]
[:new_article_attachment, "/articles/:article_id/article_attachments/new"]
[:custom_new_ar...
2006 Jul 07
5
link_to: link is missing id
I''m using a legacy table, where the unique id is not ''id''
I have a Model class like the following:
class Article < ActiveRecord::Base
set_primary_key "ARTICLE_ID"
end
however, using a link_to like the following (modified scaffolding),
the link has no id value:
<% for article in @articles %>
<tr>
<% for column in Article.content_columns %>
<td><%=h article.send(column.name) %></td>
<% end %>
<...
2010 Mar 27
2
Shorter Rails 3 routes
...I would like to shorten its routes.
Here they are:
Blog::Application.routes.draw do
resources :categories do
resources :articles do
resources :comments
end
end
A rake routes command produce the following lines:
GET
/categories/:category_id/articles/:article_id/comments(.:format)
{:controller=>"comments", :action=>"index"}
category_article_comments POST
/categories/:category_id/articles/:article_id/comments(.:format)
{:controller=>"comments", :action=>"create"}
new_category_article_comment GET
/cate...
2011 Dec 16
3
PROBLEN IN AJAX USING RJS
I am using rails 3. I have problem in out put so please tell me my
mistake
routes
-------
entermatch ''/view_article/:user_id/:article_id'' =>
''articles#view_article'', :as => :view_article
resources :users do
resources :articles do
resources :comments
end
end
article controller
------------------
def view_article
@user = User.find(params[:user_id])
@article = Article.fi...
2006 Feb 21
6
Select articles from group with id ''1'' and id ''2''
...ement,
name varchar(16) NOT NULL,
description varchar(32) NOT NULL,
constraint fk_items_users foreign key (user_id) references users(id),
primary key (id)
);
CREATE TABLE article_groups (
id int auto_increment,
expires_date datetime,
suspend datetime,
group_id int NOT NULL, # FOREIGN KEY groups.id,
article_id int NOT NULL, # FOREIGN KEY articles.id
constraint fk_items_groups foreign key (group_id) references
groups(id),
constraint fk_items_articles foreign key (article_id) references
article(id),
primary key (id)
);
- Henrik
2008 Jan 11
3
Date range queries return zero results
...command to load the db:
index << {:title => row[7].to_i,
:date => Date.strptime(row[3], ''%Y-%m-%d''),
:page_id => row[5].to_i,
:page => row[6].to_i,
:content_type => row[1].to_i,
:article_id => row[4].to_i,
:label => row[2],
:label_sort => row[8],
:content => row[0]
}
Notice "Date.strptime(row[3], ''%Y-%m-%d'')"...
When I query (ex. +label:barbara) I get results in the form:
{:label=...
2009 Nov 12
1
Please help me ------ Mapping an item to article
...menuitem) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :title %><br />
<%= f.text_field :title %>
</p>
<p>
<%= f.label :alias %><br />
<%= f.text_field :alias %>
</p>
<p>
<%= f.label :article_id %><br />
<%= f.text_field :article_id %>
</p>
<p>
<%= f.label :published %><br />
<%= f.check_box :published %>
</p>
<p>
<%= f.label :link %><br />
<%= f.text_field :link %>
</p>
<p...
2006 Jan 09
4
Problem with habtm and resulting SQL insert
...< ActiveRecord::Base
has_and_belongs_to_many :readers, :class_name => "User", :join_table
=> "read_articles"
...
end
When I do a
a = User.find(1)
b = Article.find(12)
a.read_articles << b
The SQL looks like:
INSERT INTO read_articles (`updated_at`, `id`, `article_id`, `user_id`,
`created_at`) VALUES (''2005-12-10 23:26:56'', 12, 12, 1, ''2005-12-05
03:44:01'')
The problem is that the `id` field will be set with the article_id. The
`id` should be set by the database.
The SQL definition of read_articles looks like this:
mysq...
2009 Jul 17
1
attachment_fu :partition => lamda {}
Hi -
I am trying to dynamically create my partition folders via
attachment_fu. I have read about a hack that allows you to do this on
the attachment model:
:partition => lambda {|a| a.article_id}
Which passes the model''s object into the lambda and uses the
''article_id'' attribute as its directory name. However, this isn''t
work for me. I think the lambda is simply evaluating as ''true'' and
causing attachment_fu to simply do conventional...
2008 Dec 31
1
resource api docs not working for me
Hi,
ruby 1.8.4, rails 2.2.2, mongrel 1.5.1, win xp
I read in the docs that this :
map.resources :articles do |article|
article.resources :comments
end
should result in this lot:
article_comments_url(@article)
article_comment_url(@article, @comment)
article_comments_url(:article_id => @article)
article_comment_url(:article_id => @article, :id => @comment)
So when I did my own idea of the above :
map.resource :people,:singular=>:person do |person|
person.resources :invitations;
end
I was surprised to find no method such as person_invitations (with or
without...
2008 Jul 16
2
params for link_to_remote
Hello :-),
i want to use ''link_to_remote'' to create a simple form on the website.
The form is a simple editor to post a comment to an article. I need to
know the article_id in the new view/controller. With ''render''
everything works fine, but ''link_to_remote'' doesnt work with :params :-
(
here is my code of the article view:
<div id="editor">
</div>
<%= link_to_remote("new comment", :update...
2010 Feb 16
0
Strange routing(?) Issue
...PUT /
comments/:id(.:format)
{:action=>"update", :controller=>"comments"}
DELETE /
comments/:id(.:format)
{:action=>"destroy", :controller=>"comments"}
article_comments GET /articles/:article_id/
comments(.:format)
{:action=>"index", :controller=>"comments"}
POST /articles/:article_id/
comments(.:format)
{:action=>"create", :controller=>"comments"}
new_article_comment GET /articles/:a...
2009 Sep 19
2
MethodNotAllowed
..." view, I
get "ActionController::MethodNotAllowed - only get, put, and delete
requests are allowed". This should flow through the "update" action,
which is a put method, and when I used rake routes on the command line
it looks like it is routed correctly PUT /articles/:article_id/
sources/:id(.:format) {:controller => "sources", :action =>
"update"}
My edit view contains the following code:
<% form_for :source, @source, :url => {:action => "update"} do |f| %>
....form fields....
<%= f.submit "Update" %>
&...
2001 Apr 05
2
New type of copy-protected audio CDs are coming...
...gt;From the article:
"The record business wants to lock down songs on a new breed of CDs. Is this
the end of rip, mix and burn? We visit the labels' laboratories to learn
more about what 'stickiness' means to music."
Read the full article here:
http://www.inside.com/jcs/Story?article_id=26900&pod_id=9
Oh, and CDparanoia is mentioned in the article :-)
Greetings,
Aleksandar
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-request@xiph.org'
containing on...
2006 Jul 22
12
Community request - can someone show me REST?
I mentioned this in another thread, but I''ve got a formal request now.
After reading tons of stuff about REST, I don''t really get it. I
need to see an example.
I''d like someone to write up an example blog app with these requirements
- RESTful using the simply_restful plugin (or edge rails)
- allows posting of comments to articles
- has categories for posts
No need
2006 Apr 01
2
ActiveRecord callbacks not called
...ng wrong somewhere in my unit test because
there''s a model I can''t have any callback executed on.
In my unit test I do
@image = Image.new
@image.set_uploaded_file({:file =>
uploaded_file("pic1.jpg","image/jpeg","article-picture.jpg"),
:article_id => @article.id,
:title => ''Titre test''
})
breakpoint
assert @image.save
When breakpointing, and trying @image.save manually I get a "true" as a
result. So I presume everything went fine.
The model is :
class Image < ActiveRecord::Base
belo...
2006 Jan 31
1
retrieving attributes of searchresults
...upid question and that the answer is obvious i dont
seem to be able to find it.
regards m
------------>8-------------------------------------------------------
## vital parts of indexer
################################
my $doc = Search::Xapian::Document->new();
$doc->set_data($data->{article_id});
_add_attr($doc, { # pass fields with multifield values as arrayref
'XAID' => $data->{article_id},
'XTITLE' => $title, # arrayref
'XDATE' => $data->{publicationdate},
'XTYPE' => $data->{articletype},
'...
2010 Jun 20
0
ActiveRecord and ARel: correlated subqueries?
...SQL with
ARel, if only I could see how.
Let''s take Article with multiple Versions as an example. With ARel
alone, I can find articles with their latest versions like this
articles = Article.arel_table
versions = Article.arel_table
articles.join(versions).on(articles[:id].eq(versions[:article_id])).
where(versions[:revision].eq(
versions.project(versions[:revision].maximum).
where(versions[:article_id].eq(articles[:id]))))
That doesn''t help me much in the context of ActiveRecord. There, I''d
like to define things like this
class Article < ActiveRecord::Ba...
2006 Jan 04
4
Need some implementation ideas :-)
Hi,
I have good this cool challenge from my boss on developing a very simple
cms-like system to publish articles within. The caveat is that he wants
to have multi-lingual content.
At first I thought RoR would be perfect for the assignment but right now
I''m not so sure.
My first attempt involved creating a table for each model/languagde like
this:
articles_en
articles_dk
articles_de
2006 Mar 27
1
Tests not tiding up after themselves?
...40) not null,
primary key (id)
);
create table articles (
id int not null auto_increment,
headline_id int not null,
description text,
constraint fk_article_headline foreign key (headline_id) references
headlines(id),
primary key (id)
);
create table changes (
id int not null auto_increment,
article_id int not null,
summary text not null,
diff text,
constraint fk_change_article foreign key (article_id) references articles(id),
primary key (id)
);
----
The Headline class declares a "has_one" relationship to the Article
class. And the Article class declares a "has_many" rel...