similar to: Partials and controllers

Displaying 20 results from an estimated 200 matches similar to: "Partials and controllers"

2006 Jan 30
1
acts_as_taggable => error: undefined method ''tag''
I get an "undefined method ''tag''" when I try to use the acts_as_taggable. Note that it''s not the issue of bouncing webrick after changing the environment.rb file. (I stumbled on that too... :-( ). I read all the doc I could find (on this site, on http://rails.techno-weenie.net and at http://taggable.rubyforge.org/) but I couldn''t find anything I
2007 Sep 08
2
"Common action" for a controller
Sorry if this has been asked before; it seems like a simple problem. I have a controller called ItemController which displays information about specific items to a user on various pages. The routing looks like "items/:item/:action". Is there any way to automatically look up the :item in the items table (it''s just an ID). I tried: before_filter { @current_item =
2006 Feb 21
6
Select articles from group with id ''1'' and id ''2''
I have to tables: "articles" and "groups". Between I have article_groups as a jointable. Now I want to select every article who is a member of group with id ''1'' and id ''2''. Whats best way to get that? Extract from schemas: CREATE TABLE articles ( id int auto_increment, ingress text NOT NULL, story_text longtext, constraint fk_items_users
2005 Aug 15
2
Newbie rendering problem
Hi On every list request i render an item partial through a collection of items. the item table has 3 columns namely name,anotherName and id. the item partial looks like <%@item=item%> <%= error_messages_for(:item) %> <tr id="<%=item.id%>"> <% for column in Item.content_columns %> <td><%=h item.send(column.name) %></td> <%
2006 Jan 28
6
Check if user is in right group
What is the best way of checking this? I have 3 tables: groups users group_members class GroupMember < ActiveRecord::Base belongs_to :group belongs_to :user validates_uniqueness_of :user_id, :scope => "group_id" Then I want a method here that checks if a given user is a member of a given group. What is the right way of doing that? def
2006 May 06
7
New Ajax and Rails tutorial
Hi, I just published the first version of a small tutorial I''ve written on Ajax and Rails. It is called "How to paginate, sort and search a table with Ajax and Rails" (sorry, I didn''t manage to find a longer title !) and is available at : http://dev.nozav.org/rails_ajax_table.html There is nothing really new in it, it''s rather a compilation and
2006 Apr 08
5
rails.el on Ubuntu
Anybody who have a working .emacs (++) for Ubuntu (or Debian) with the newest emacs-rails (v.0.3). I have especially trouble with getting HTML Mode Snippets to work. - Henrik
2006 Apr 24
7
Can you improve on this code?
# File app/models/timesheet.rb, line 27 27: def totals 28: totals = Hash.new 29: totals["Monday"] = totals["Tuesday"] = totals["Wednesday"] = totals["Thursday"] = totals["Friday"] = totals["Saturday"] = totals["Sunday"] = totals["Totals"]=0 #initialise all to zero 31: 32: for item in
2006 Jun 21
7
acts_as_taggable and paginate?
Hi there, I''ve been trying to paginate over a list of members that all share a tag in common using the acts_as_taggable plugin. The regular way of paginating over a collection doesn''t seem to work with acts_as_taggable. Here''s what my method looks like that takes in a tag name, finds all the members that share the tag and then displays all the members. Nothing too fancy
2006 Jan 20
1
Update HTML Element with Ajax
I have following files. list.rhtml ----------------------- <ul id="items"> <%= render(:partial => ''item'', :collection => @items) %> </ul> _item.rhtml ------------------------ <li id="<%= item.id %>" > <%= item.name %> <%= item.body %> </li> edit.rjs ------------------------ page.replace_html
2006 Feb 10
0
ajax form submission and updating multiple divs
I''m not sure if this is even possible, but here is my current method: class Item < ActiveRecord::Base def self.generate(name) Item.create(:name => name) || nil end end class ItemController < ActionController::Base layout "application" def index @items = Item.find(:all) end def create if @request.method ==:post name = @params[:name]
2006 Feb 14
0
Best practices for handling associations in ctrlrs/views
Forgive me if this topic has come up before. I''m new to Rails (from a Java background, with a good deal of Perl as well.) I''m very much attracted to the idea of having an integrated MVC stack, and from what I see, Rails is "the right thing." To set up my question, here''s some background. In an app I am building, there are three models: an item has many
2007 Mar 24
0
overloading to_json with JSON gem installed causing error
I installed the JSON gem because I wanted the JSON parser. Before installing the JSON gem, overloading worked fine. Before I remove it, I''d like to see if anyone has an idea of what is going on. It''s the only JSON parser I''m aware of, so it would be a bummer if it didn''t work. After installing, if I overload the to_json method in the class, it gives me the
2006 Apr 29
11
Multiple actions from one form - possible?
Hello * Obviously the rhtml below does not work, but it should be apparent what I try to achieve - I would like to give the user the choice to submit a form either to action1 or action2 but I cannot figure out how?! It would be great if someone could give some assistance. Thanks a lot, Alex <%= start_form_tag :action1 => ''save'', :action2 =>
2006 Jan 09
1
Problem with RecordNotFound without numeric id
Hi all, I have a problem handling errors for RecordNotFound (Page 86 of Agile Book), I want to redirect bad items id to "list" with a flash "Invalid Item", but this works only with numeric id, if I use some like "wibble" the result is an empty list of items. This is in my item_controller: def show @item = Item.find(params[:id]) rescue redirect_to :action
2006 Jan 25
1
cache_sweeper causes undefined method error
I created a sweeper ItemSweeper and saved it in app/models/item_sweeper.rb. Then I put this in my item_controller.rb: cache_sweeper :item_sweeper, :only => [:create, :destroy, :update] But now when I call the view action, I get this error: ActionView::TemplateError (undefined method `title'' for nil:NilClass) on line #5 of app/views/item/view.rhtml: 5: <H1
2006 Apr 12
1
Dynamically updating list
hi every body. i am try to do example of agil books.dynamically updating list of chapter 18. 1)this is my code for controller---- class ListnoajaxController < ApplicationController def index @items = Item.find_recent end def add_item item = Item.new(params[:item_body]) render(:partial => "item", :object => item) end def item end end 2)the code for item class in app/model class
2006 Aug 01
3
paginate, search, sort with ajax problem
hello I hope somebody can help me figure this out. found this great tutorial at http://dev.nozav.org/rails_ajax_table.html. got it working except for one thing. I can''t seem to make the pagination work. The link_to_remote defined in the helper is pointing to the wrong url. I have set up things like so: defined a search method in de project_controller located in apps/admin/project.
2006 Apr 08
76
MIT vs GPL vs LGPL for open source project
I intend to release a project I wrote with Rails. What is the right licensing scheme for a web application (content managing system) which could grow with plugins and add-ons ? Personally, I would prefer the GPL but does that mean any add-on to the CMS (like task management) will have to be GPL ? If some people contribute to the code could it still be double-licenced so that the people who
2006 Feb 14
2
Inline list editing with RJS: best practices
I wanted to get the community opinion on the best way to use partials and inline list (<li>) editing. I have a very common scenario where a list is rendered: --- index.rhtml --- <ul> <%= render :partial => ''item'', @collection => @items %> </ul> --- _item.rhtml (simplified) --- <li id="item_<%= item.id %>"> <div