search for: storiescontrol

Displaying 6 results from an estimated 6 matches for "storiescontrol".

2005 Dec 23
6
Stories with many tags, tags with many stories, has_and_belongs_to_many howto?
...ething like this (snippets): class Tag < ActiveRecord::Base def self.create(taglist) tags = Array.new count = 0 taglist.split(/,/).each do |tag| tags[count] = Tag.new(:name => tag.chop.downcase) count += count end end end class StoriesController < ApplicationController def create @tags = Tag.create(params[:tags][:tags]) params[:story][:tags] = @tags @story = Story.new(params[:story]) render_text @tags.length end end params[:tags][:tags] can be something like "cats, dogs, pets". With that code, I get: &...
2008 Dec 20
3
undefined method `stories_path'
...iew/helpers/form_helper.rb:269:in `apply_form_for_options!'' /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/form_helper.rb:248:in `form_for'' /var/www/html/railsapps/shovell/dev/app/views/stories/new.html.erb:1 controller: class StoriesController < ApplicationController def index @story = Story.find_by_name(''SitePoint Forums'') end def new @story = Story.new end end view: <% form_for @story do |f| %> <p> name: <br /> <%= f.text_field :name %> </p> <p> link:...
2006 Jan 12
17
Application.rb params
I need to check if a parameter is set so that I can build some information for my application, but No matter how I format my if statement in the file " Application.rb" it return the following error. You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occurred while evaluating nil.[] Here is the line if params[:day] So we
2010 Jun 17
7
Why do rails calls a method when I'm calling a property?
...ting on RoR, so I got a Book called simply rails...Following the steps in it sometimes when I try to call a property, the browser shows me the next exception: undefined method `name'' for nil:NilClass I don''t know why...here''s my controller: #Controller starts here class StoriesController < ApplicationController before_filter :login_required, :only => [ :new, :create] def index get_stories ''votes_count >= 5'' end def bin get_stories '''' render :action => ''index'' end protected def get_stor...
2009 Sep 29
5
NoMethodError in Stories#show
I''m a Rails newbie and am working my way through Simply Rails 2 by Patrick Lenz. Have run into a problem on page 207 of the book; this is the error I run into when I fire up my server and open up httpL//localhost:3000/ stories/new I have posted the error message and trace below. Thanks in advance for your help.
2008 Jul 24
0
Re: Simple functional test fails
Quoting txapelgorri <ibon.castilla-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > Hi there: > > I''m starting with rails and I founded and issue that I can''t figure > out how to solve: > > - This is the controller: > class StoriesController < ApplicationController > def index > @current_time = Time.now > @story = Story.find_by_name(''txapelgorri'') > @rand_story = Story.find(:first, :order => ''RANDOM()'') > end > end > - This is the view: > <p&gt...