# params and attributes confusion. Maybe my routes? I included my code and log snips.

**URL:** <https://discuss.rubyonrails.org/t/params-and-attributes-confusion-maybe-my-routes-i-included-my-code-and-log-snips/7729>\
**Category:** rubyonrails-talk\
**Created:** [January 24, 2007, 6:07pm UTC](https://discuss.rubyonrails.org/t/params-and-attributes-confusion-maybe-my-routes-i-included-my-code-and-log-snips/7729 "2007-01-24T18:07:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Steinfeld](https://avatars.discourse-cdn.com/v4/letter/m/bc79bd/32.png) [@Michael\_Steinfeld](https://discuss.rubyonrails.org/u/Michael_Steinfeld)\
**Post date:** [January 24, 2007, 6:07pm UTC](https://discuss.rubyonrails.org/t/params-and-attributes-confusion-maybe-my-routes-i-included-my-code-and-log-snips/7729/1 "2007-01-24T18:07:09Z")

</div>

hi all,

I am using Ruby 1.8.4 and Rails 1.2.1 recently updated in the middle of my app development.

The controller I have to explicitly set the action “view” shouldn’t that be automatic since I have a view.rhtml file?

for some reason the code I have in the view never get’s displayed. I have listed my methods and the error I am getting in my logs. Maybe I am overseeing something or just flat out doing something wrong. Any help would be appreciated.

–Post Model– def self.find\_all\_by\_slug(slug) Post.find(:all, :conditions =\> [“slug = ?”, slug]) end

–Controller– def view @post = Post.find\_all\_by\_slug (params[:slug]) render\_action “view” end

–Routes–

map.connect “posts/:year/:month/:day”, :controller =\> “blog”, :action =\> “find\_by\_date”,

```
        :requirements => { :year => /(19|20)\d\d/,
                            :month => /[01]?\d/,
                            :day => /[0-3]?\d/},
        :day => nil,
        :month => nil,

        :slug => ''

```

map.connect “posts/view/:slug”

–view.rhtml–

\<% for p in @post %\>

# \<%= p.title %\>
 \<%= p.text\_html %\> \<% end %\>

–log file–

i see that the slug is NULL in the sql query, I don’t know why in this case the slug “First-Post” is being assigned to id. I am guessing this is all part of my problems.

Processing BlogController#view (for [68.34.158.137](http://68.34.158.137) at 2007-01-24 12:53:26) [GET] Session ID: 86a14c90a137fe4afb8075799005253c Parameters: {“action”=\>“view”, “id”=\>“First-Post”, “controller”=\>“blog”}

[4;35;1mPost Load (0.000531)[0m [0mSELECT \* FROM posts WHERE (slug = NULL) [0m Rendering statusfileblog/viewlayoutfalseuse\_full\_pathtrue within layouts/blog Rendering blog/view Completed in 0.00552 (181 reqs/sec) | DB: 0.00053 (9%) | 200 OK [[http://blog.poordog.net/blog/view/First-Post](http://blog.poordog.net/blog/view/First-Post)]

Processing Base#index (for [68.34.158.137](http://68.34.158.137) at 2007-01-24 12:53:26) [GET]

Session ID: 86a14c90a137fe4afb8075799005253c Parameters: {}

ActionController::RoutingError (no route found to match “/images/footer\_logo.gif” with {:method=\>:get}): /vendor/rails/actionpack/lib/action\_controller/routing.rb:1250:in `recognize\_path’

```
/vendor/rails/actionpack/lib/action_controller/routing.rb:1240:in `recognize'
/vendor/rails/railties/lib/dispatcher.rb:40:in `dispatch'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0/lib/mongrel/rails.rb:78:in `process'

/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0/lib/mongrel/rails.rb:76:in `process'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0/lib/mongrel.rb:618:in `process_client'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-

```

1.0/lib/mongrel.rb:617:in `process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0/lib/mongrel.rb:736:in `run’ /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0/lib/mongrel.rb:736:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel- 1.0/lib/mongrel.rb:720:in `run’ /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0/lib/mongrel/configurator.rb:271:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0/lib/mongrel/configurator.rb:270:in `run’

```
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0/bin/mongrel_rails:127:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0/lib/mongrel/command.rb:211:in `run'
/usr/local/lib/ruby/gems/1.8/gems/mongrel-

```

1.0/bin/mongrel\_rails:243 /usr/local/bin/mongrel\_rails:18

Rendering /Users/mike/code/mikesrepo/betablog/config/…/vendor/rails/actionpack/lib/action\_controller/templates/rescues/layout.rhtml (404 Page Not Found)

Thanks,
