Displaying 16 results from an estimated 16 matches for "author_nam".
Did you mean:
author_name
2011 May 20
3
How to handle non model data in form?
...do |f|
= errors_for(@article)
.field
= f.label :text
%br
= f.text_field :text
.field
= f.label :author_id
%br
= f.text_field :author_id
.actions
= f.submit
But since I don''t want anyone to type in an author id I changed it to:
.field
= f.label :author_name
%br
= f.text_field :author_name
added to article.rb:
attr_accessible :author_name
def before_validation
if self.author_name
author_name = self.author_name.split
self.author =
Author.find_or_create_by_firstname_and_lastname(author_name[0],
author_name[1])
end
But now this line:
@arti...
2005 Apr 20
4
Error in tutorial or sintax changed?
Hi,
In this tutorial
http://wiki.rubyonrails.com/rails/show/HowtoUseJoinsWithFindAll
it sad:
sql =<<SQL
SELECT articles.*, authors.name AS author_name
FROM articles
LEFT JOIN authors ON author_id = authors.id
SQL
and this return
*app/controllers/media_controller.rb:366: can''t find string "SQL"
anywhere before EOF*
what is wrong? the tutorial or ruby changed?
please, how I insert a text in a variable? (widout " or '...
2006 Jun 30
5
If / Else Form layout question.
Hello all,
I''m using the following _form.rhtml layout for a number of pages,
including edit record and new record (which each has it''s own definition
in the controller).
I''d like to display a different author form field depending on which
page they are using. I''d rather keep using _form.rhtml as a layout
template, instead of customizing each separate page.
2006 Jun 11
3
[SUMMARY] Rails Core Weekly June 5 - June 11
...ngeset/4440">uninstall.rb</a> that
makes it possible to uninstall plugins.
We''ve spoken about it before in RCW but Hampton''s solution to wrap
your conditional bind variables in a hashes is committed by DHH. So
now, no more of this:
Topic.find(1, :conditions => [:author_name = ? and :title = ?,
@author.name, ''AWWR''])
but simply
Topic.find(1, :conditions => { :author_name => "David", :title => "AWWR" }
will do just fine. That''s so much better on my eyes, thanks again Hampton.
Also Jamis makes sure Named Routes...
2006 Oct 19
3
joins and table names in ferret
I''m having trouble figuring out how to do Ferret queries across multiple
tables as you would in a normal SQL call. For example, let''s say I have
two ActiveRecord classes, Book, and Author, where Book has a
''description'' field and Author has a ''name'' field, and where Book has a
belongs_to relationship with Author (Book belolngs to Author,
2007 Apr 27
1
Return which field/index a result hit was found in
...to search
the Book model and the associations as follows:
class Book < ActiveRecord::Base
...
#asociations
has_many :details
has_many :authors etc...
...
# acts as ferret implementation
acts_as_ferret :fields => [:title, :tag_list, :comments_list,
:details_value_list, :details_title_list, :author_names]
def details_value_list
return self.details.collect do |detail|
detail.value
end.join(",")
end
def details_title_list
return self.details.collect do |detail|
detail.title
end.join(",")
end
def details_text
re...
2007 Apr 13
5
undefined method `ferret_index'' for xxx:Class
Hi I am trying to use ferret; the regular search works; but when I use
the find_storage_by_contents to highlight the results, I am getting the
above error. Please help
thanks
--
Posted via http://www.ruby-forum.com/.
2006 Jul 18
2
A quick question on forms
...help.
Steve.
<%= error_messages_for ''post'' %>
<!--[form:post]-->
<p><label for="post_title">Title</label><br/>
<%= text_field ''post'', ''title'' %></p>
<p><label for="post_author_name">Author''s Name</label><br/>
<%= text_field ''post'', ''author_name'' %></p>
<p><label for="post_permalink">Permalink</label><br/>
<%= text_field ''post'', ''perma...
2006 Jul 22
0
RSS XML Generation Problem
...;){
xml.channel{
xml.title("mytitle")
xml.link("http://www.myapp.com")
xml.description("mydescription")
xml.language(''en-us'')
for post in @posts
xml.item do
@author = "\"#{post.title}\" by, #{post.author_name}"
@influence = "Disclosure: #{post.disclosure} [Influence Level:
#{post.influence_level}]"
xml.title(@author)
xml.category(post.influence_level)
xml.description(@influence)
xml.pubDate(post.created_at.rfc2822)...
2011 Sep 04
1
polymorphic association
Hello,
I have a scenario where I want to save a author image and book image to
assets table...
I am using a polymorphic association.
And author_name is inside the books table.
now when I save the image the imageable_type says "Book" for both. And
off-course it''s a correct behavior, but I am just trying to figure out is
there any way where I can save author image and imageable_type should have
"AuthorImage" and it...
2011 Oct 25
1
Customizing errors
Hello fellow Rails devs,
I had a slight problem with validation messages. I had a Post AR model
that has an :author_name attribute.
Now if a validation goes wrong, I would like the message to say: "Name
of author can''t be blank" as opposed to "author name can''t be blank".
I have tried looking into the Rails Guides for I18n #5 but it seems
error.full_messages does not call huma...
2008 Jan 15
7
PHP indexing, what's the PHP method for indexscript
Currently I have the following indexscript:
pid : unique=Q boolean=Q field=pid
postdate : field=startdate
author_name: unhtml boolean=XAUTHORNAME field=author
author_id: boolean=XAUTHORID field=authorid
url : field=url
sample : weight=1 index field=sample
How can I create the same indexing using PHP?
With this, I can get an searchable index, but I have no idea how to set the fields, so that I can actually GET...
2005 Sep 13
5
acts_as_taggable 1.0.4 now gemified!
Hi Folks,
The acts_as_taggable mixin is now available as a shiny gem.
More details here:
http://dema.ruby.com.br/articles/2005/09/13/acts-as-taggable-gemified
This release features some cool additions as well.
Cheers
Dema
--
http://dema.ruby.com.br - Rails from a .NET perspective
2006 Jul 02
0
Rails Core Weekly June 19 - July 2 2006
...r'' tag exists
# winter = Tag.find_or_initialize_by_name("Winter")
# winter.new_record? # true
Another example is found in the test he wrote. This uses 2 attributes
to search on:
def test_find_or_initialize_from_two_attributes
another = Topic.find_or_initialize_by_title_and_author_name("Another
topic","John")
assert_equal "Another topic", another.title
assert_equal "John", another.author_name
assert another.new_record?
end
That''s pretty useful ! His patch is quite nice I think as well, well
worth studying (uses ActiveRecord::B...
2004 Oct 25
1
Rails 0.8: Just shy of 100 additions, changes, tweaks, and fixes!
...escription(item_description(item)) if
item_description(item)
xml.pubDate(item_pubDate(item))
xml.guid(@person.firm.account.url + @recent_items.url(item))
xml.link(@person.firm.account.url + @recent_items.url(item))
xml.tag!("dc:creator", item.author_name) if
item_has_creator?(item)
end
end
end
end
...which will generate something like:
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Web Site Redesign</title>
<link>...
2006 Jan 08
22
Putting it all in one place with Schemas
I''m still relatively new to ROR, but I like what I see with the
database-neutral approach of Schemas. In the spirit of keeping it
simple and minimizing the number of files and location of information,
does ActiveState currently allow me to go ahead and place other low
level model information such as validation requirements and associations
inside the schema rather than putting it in