similar to: Accessor not set

Displaying 20 results from an estimated 5000 matches similar to: "Accessor not set"

2006 Jun 25
2
how to write the codes in view?(newbie question)
Hi. I have two tables and want to join them. <genres> id genre_name genre_order <links> id genre_id name symbol url order display etc The code of links_Controller is like below. def list @links = Genre.find(:all,:include => :link) end Below is the mysql log. SELECT genres.`id` AS t0_r0, genres.`genre_n ame` AS t0_r1, genres.`genre_order` AS t0_r2, links.`id` AS t1_r0,
2013 Apr 03
1
validates uniqueness scope allow_blank/allow_nil -> validation error
I have this in a model: class GenreBadge < ActiveRecord::Base belongs_to :game, counter_cache: :genre_badges_count, touch: true belongs_to :genre validates :game_id, uniqueness: {scope: :genre_id}, allow_blank: true end When I get one existing genre badge genre_badge = game.genre_badges.first genre_badge.game_id = nil genre_badge.save! It creates an validation exception:
2008 Jul 30
4
AssociationTypeMismatch: Genre expected, got String
Hi all I have the following 2 models: class CompactDisc < ActiveRecord::Base belongs_to :genre end class Genre < ActiveRecord::Base has_many :compact_discs end I have created a select box for my form so I can choose a genre for every compact disc: <p> <b>Genre</b><br /> <%= f.select :genre, Genre.find(:all).collect{|p| [p.name, p.id]}, :selected =>
2006 Apr 23
1
checkboxes for filtered search
I have a page that renders a series of about 20 checkboxes on the left hand side with content on the right. These checkboxes are created from a DB and that part is all working well. What I want to do is have a user click on a checkbox [genres] and have the content on the right be filtered based on the checkbox ticked. If a user clicks on more than one checkbox than only those stories
2006 Mar 05
2
AJAX call chain and DRY questions
Hey I have a page with a drop list. When the user selects an option in the drop I call an action in the controller with ajax. Now, in the controller, I gather some data from the db, but how do I present these data in a nice way? I really need to make use of the html helpers, but these clearly are not available in the controller. How do I output the array that I have gathered? My view page
2005 Mar 10
8
Login controller additions
I have added roles and roles_users table and updated the model so that my users can have multiple roles. ("Admin" role does always have id = 1). I have added these methods to my application controller. <code> helper_method :is_admin? helper_method :is_user? def is_admin? if @session[''user''] @session[''user''].roles.find(1)
2005 May 12
26
performance update
I have made additional progress with regard to performance. My latest data: configuration 1: r121.latest configuration 2: r121p.latest page c1 real c2 real c1 r/s c2 r/s c1/c2 /empty/index 6.75525 1.71983 148.0 581.5 3.93 /welcome/index 6.89044 1.89244 145.1 528.4 3.64 /rezept/index 4.99573
2005 Mar 31
4
Transactions
I cant seem to find much information apart from the basics on transactions in rails. I have 5 nested transactions, and am performing the following basic operations: @whatever1.transaction do @whatever2.transaction do .... @whatever2.something = "foo" @whatever1.something = "bar" @whatever1.save @whatever2.save ..... end end ((( I had tried using
2005 Mar 08
15
Rails 0.10.1and WEBrick
Doesn''t appear to work with WEBrick. Works find with Apache/FastCGI. Something wrong in the way Rails is trying to process paths from the WEBrick server. If I try to send in http://localhost:3000/recipes/new, WEBrick is interpreting /new as my controller, instead of my action.
2005 Mar 02
1
Defect question?
Hey guys, Take a look at http://dev.rubyonrails.org/ticket/732. The essential ''problem'' is that Rails doesn''t support a module and a class both named Customer. (::Customer, not in modules themselves) Is this something that''s even possible with ruby? it looks like it should be marked as wontfix? But as I''m a little new to ruby, I figured
2005 Mar 02
1
404 and NameError
Hi guys, I was wondering if anyone knew a fix for this problem I have. I''ve ported one of the apps I work with to Rails 0.10.0 to use Routes. Everything works great, except for 404 pages. The thing is that if I give a non existent path, I get the correct 404 error page back. However if I request a non existent file such as test.php (in fact anything non existent that isn''t a
2005 Mar 02
3
App behaves differently on Apache and Webrick
When running on the Webrick server (script/server), my app works fine. When running on Apache 2.0.52, I get the dreaded ''unitialized constant Merge'' error. Merge is the name of my model, the controller is MergesController. The deadline looms, any help appreciated! Thanks! Regards, JJ
2005 Mar 05
3
routes inconsistency?
Hello, As a small excercise in learning rails, I''ve been porting a very simple website from SSI to rails (yep, a bunch of static files that were previously served with a tiny bit of SSI magic are now served by a database-backed rails, it''s total overkill, I know). Part of the reason is that I''m trying to move from apache to lighttpd, and lighttpd''s SSI for
2005 Mar 10
10
Some Basic Questions
Sorry I can''t access IRC from work so I hope you don''t mind me asking my newbie questions here: 1) I have the following code: @post = Post.find(@params[''id'']) @comments = Comment.find_all "post_id = #@params[''id'']", "created_on ASC" And I am have problems with the second line. I want to pass the id from my post to the
2006 Mar 04
3
select helper method
Hey I''m having problems understanding the select helper. Here is my code: _____________________ DB table: genres id name descripition ___________________ In the controller: def index() @genres = Genre.find_all.map {|u|[u.name, u.id]} @id = params[''genre''] end ____________________ In the view: <% @genre = Genre.new @genre.id = @id %>
2007 Sep 23
3
Connecting a row of an unknown table to another row of an unknown table
Hello all, I''m currently designing a web app in Rails that lets me keep a directory of free/opensource computer games. Each game has attributes like name, website, review, etc., but each game can also be associated with a set of genres and gameplay elements. The main three tables I''m working with are "games", "genres", "elements",
2008 Jan 02
1
extracting pvalue from ANOVA with repeated measures
I made an ANOVA with repeated mesures (aov(Mesure~Distance*Genre*Correct+Error(Sujet/(Distance*Genre*Correct)), data)) and I would like to extract the pvalues. The output is: ----------------------------------------------------------- Error: Sujet Df Sum Sq Mean Sq F value Pr(>F) Residuals 21 97.082 4.623 Error: Sujet:Distance Df Sum Sq Mean Sq F value Pr(>F) Distance
2005 Dec 15
2
HABTM being tricky
I''ve just been bodyslammed by a problem with has_and_belongs_to_many - as far as I can tell, if it doesn''t appear at the top of other relationship definitions it doesn''t seem to work right. For example: class Artist < ActiveRecord::Base has_and_belongs_to_many :genres has_many :albums has_many :videos has_many :cds has_many :collections end ..works fine
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 #...
2012 Jun 14
3
response.should have_content("1 movie") does not seem to work for me
Hey everybody I have worked quite to near the end of The RSpec Book, but now I''m having some troubles. I''m trying to get the last few Cucumber steps to work, which are: Then /^Caddyshack should be in the Comedy genre$/ do visit genres_path click_link "Comedy" save_and_open_page response.should have_content("1 movie") response.should