Displaying 12 results from an estimated 12 matches for "contentcontroller".
2006 Jan 17
9
Setting layout template in .rhtml
I''ve a single controller -
class ContentController < ApplicationController end
in the app/views/content folder I have quite a few .rhtml files
I need to be able to choose a different layout template to
use in each of these .rhtml files.
i''d like to be able to do something like (which doesn''t work..)
<% layout ''l...
2006 Feb 17
7
Create and then show
...reating a new
object. So, for example, once a new post is created the user is
presented with the new post in a show view. The problem is I can''t get
the correct <at> post.id to send to the show method. Rails always
returns 0 for this value.
Here''s what I have so far:
class ContentController < ApplicationController
def new
<at> post = Post.new(params[:post])
if request.post? and <at> post.save
redirect_to :action => ''show'', :id => <at> post.id
else
...
end
end
def show
<at> post = Post.find(param...
2013 Jan 07
4
JSON::ParserError in controller
...uri = URI("http://www.zed451.com")
response = Net::HTTP.get_response(uri)
@hash = JSON(response.body)
puts "#{@hash}"
end
end
I call the above method in my controller and send @hash to view.
In my browser I see the below error:
JSON::ParserError in Original contentController#index
706: unexpected token at ''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
And the rest of the page is printed without error in html format.
--
Posted via http://www.ruby-forum.co...
2006 Nov 04
0
Question about named routes - getting "No url can be generated for the hash"
So I''ve decided to clean up the structure of my rails app and have
been using named routes and storing certain controllers underneath
other controllers where appropriate.. For example, I have an
AdminController, as well as a ContentController. I decided to make
ContentController a subclass of the AdminController, because the
content management portion of the site is only accessible to
administrators, and that way I can use the following hierarchy:
app/controllers/admin/content_controller.rb.
I also have the following routes defined:...
2006 Aug 03
1
routeset mapper problem
...:layout => ''content'',
:use_cache => ''true'',
:cache_path => nil,
:force_utf8 => Comatose::Options.force_utf8.to_s,
:named_route=> nil
}.merge(options)
# Ensure the controller is aware of the mount point...
ContentController.add_root(path, opts[:index])
# Add the route...
opts[:controller] = ''content''
opts[:action] =''show''
route_name = opts.delete(:named_route)
unless route_name.nil?
named_route( route_name, "#{path}/*page", opts )
else
i...
2006 Aug 18
0
Impact of inheriting controllers on models
...er
\
-- AdminArea Controller
--\
----dashboard controller
----user controller
----content controller
----\
------page controller
------placement controller
-- PublicArea Controller
--\
........
At the deepest level the class definition looks like:
class Admin::Content::PagesController < Admin::ContentController
Now, for some reason this has just started to cause problems when trying
to use one of the search plugins available (specifically I have tried
ActiveSearch and Acts_as_ferret). For some reason when trying to trigger
a CRUD action on a model which has acts_as_ferret or indexes_columns
specified...
2007 Jul 28
0
Problem with acts_as_ferret demo
Hi Jens,
I copied the demo folder into my rails apps and also created the
ferret_production and ferret_test databases.
when I start the server and type this in the browser:
localhost:3000/content
I get the following error:
NameError in ContentController#new
uninitialized constant Ferret::Search::BooleanClause
RAILS_ROOT: ./script/../config/..
Application Trace | Framework Trace | Full Trace
F:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:263:in
`load_missing_constant''
F:/InstantRails/ru...
1999 Dec 16
0
SAMBA digest 2343
The message that was sent to darryn.franklin@cmp.co.nz
has been detected as having
attachments where the content is unknown and is being held awaiting a
further check.
The message will be processed within the next 24 hours. If this message is
a legitimate work related message and does not contain any inapproparate
content then it will be released to the addressed person(s).
If not the message
2006 Nov 04
0
Problem with edge rails, controller namespaces and routes
...h of my site''s content. I''ve decided to make this a
subclass of Admin, so I can organize my administrative related
controllers into their own directory. So I have the following class
definition inside ''app/controllers/admin/content_controller.rb'':
class Admin::ContentController < ApplicationController
....
end
and then in my routes file, I have:
map.with_options(:controller => ''admin/content'') do |content|
content.content_list_faq
''admin/content/faq/list/:section'', :action => ''list_faq''
end
now, this...
2006 Apr 13
2
One model won''t work like the others, generating weird error
..., I get the
following error:
(eval):1:in `compute_type'': compile error
(eval):1: parse error, unexpected tINTEGER
Object::2
The model itself couldn''t be any simpler:
class Team < ActiveRecord::Base
end
The controller calling it is as follows:
class RostersController < ContentController
layout :theme_layout
helper :articles
model :team
def index
ac_teams =
[''COU'',''TRI'',''CAP'',''BUF'',''MCM'',''WMS'',''PHI'',''BOW'',''PAD'...
2005 Aug 19
3
accessing DB result in template
hello,
I have the following in my controller
def totalmembers
@total = User.find_by_sql "SELECT COUNT(*) as count FROM users "
end
now inside my template how do i access the field "count" from the
query so i can print out the number of members ?
I tried everythign like <%= @total.count %> but nothing works.
thanks
adam
2007 May 15
5
Problem with RJS and/or Prototype.js =>ResponseText is blank
Hi, I''ve got a real head-scratcher. I''ve got a standard Ajax form using
form_remote_tag, which calls a controller action which adds a comment
and then sends back some JS via RJS which updates a few items on the
page.
It did work fine but (and I''ve no idea what has happened) now it
doesn''t. It calls the controller action but gets an empty response back
and