similar to: Helpers for partials too ?

Displaying 20 results from an estimated 2000 matches similar to: "Helpers for partials too ?"

2006 Aug 04
1
Need a better undersanding of form helpers
perhaps someone can take a little time to give me a better understanding of how to use form helpers. Here is what I''m working with in my app: user model - (the table where a user registers their information) it contains the following fields - first_name last_name email account_type (currently set to string but will probably be a select box with options) password_salt (I''m
2011 Jul 06
5
Monkey patching a gem (rails_admin, with Rails 3)
Hi. I''m trying to monkey patch the rails_admin gem. First, I tried to add a file in config/initializers containing: RailsAdmin::MainController.class_eval do def get_sort_hash CODE HERE... end end It was only loaded once, and then the method from the gem was always executed instead of mine. I also tried to add the code in lib/ with the correct line in config/application.rb to load
2006 Apr 12
3
noob question
Hi *, I am writing my first app based on the ''depot'' application but with some suttle differences to help me learn. I am a bit sutck with following and would be grateful for any help: I have the following controller: class MainController < ApplicationController def index @objects = Object.certified_items end end This relates to a field called
2006 Jun 18
2
Why can''t I use a session? (Symbol as array index)
Hi All I can''t for the life of me see what is wrong with this. Maybe it''s cause it''s midnight... I want to put some data in a session and I have some code like this: class ApplicationController < ActionController::Base model :mything def ApplicationController.chosen_thing session[:chosen_thing] ||= MyThing.defaultThing end end So whenever I try to
2006 Apr 25
7
Rails producing the / page.
Hi all Very simple question, im sure, but I cant find docs anywhere that tell me how to do this. What I want is for the index page of the server to be generated from rails, is www.wibble.com/ will result in a page that has been processed by rails, has the templates etc. >From what I can see, the index page comes from public/index.html How do I get this to be a rails page? Thanks Jonathan
2012 Jan 04
1
render :update problem with IE 9
Hi, I have a legacy web site based on ruby on rails 3.0.9 which works just fine with Firefox, chrome and IE 8, but I receive an HTTP 406 error every time when I check the web site with Internet Explorer 9. I narrowed down the problem to the respond_to + format.js + render :update trio, but I did not manage to solve the problem until now. I created a small example for reproduction: The action
2008 Mar 04
9
What is your workflow? Or how to use the story runner the right way.
I really would like to know how people are using the Story and Example runner to write their software.It would be great to get some direction on it, because I think I''m missing some points. Taking the outside-in approach in thought: At first we write a high-level customer-facing story, this story fails. Then we start using mocks at object level to use them as a design tool, and so we
2012 Sep 05
2
Partials and helpers
Hi, Is there any reason why helpers cannot render partials? I would like to do something like this in the layout: <body> <%= magic_header %> <%= yield %> </body> and then have a magic_header helper def magic_helper ...do some magic... render partial: "magic_helper" end Why is this wrong? Cumprimentos, Luís Ferreira -- You received this
2006 Apr 26
0
partials or helpers: which to use?
Hi, Just wondering: when do people use a helper and when a partial? I''ve just converted a bunch of partials into helpers because I didn''t like the syntax of partials where I can had to pass in a :locals hash every time. I wonder what advantages a partial has over a helper and vice versa. I guess a partial has easier access to the controller and various assigned variables,
2007 Jul 16
0
Partials vs. Helpers
I have several partials containing dynamic codes (already memcached all the fragments as best I could), which I reuse ( render :partial => "stuff.rhtml" ) a lot within a single action call. For example, I have a partial which defines how an entry is to be formated in HTML. I have 40 entries on a page, so the partial is rendered 40 times in a single action. Not knowing the
2006 May 22
13
How is this possible?
When run from the console, the following code works, when run through the WEBrick server I get a "You have a nil object where you didn''t expect it!" class Competition < ActiveRecord::Base has_many :comp_dates, :order=>:position def initial_date comp_dates.first end def display_dates i_d = initial_date if i_d.nil? return "unknown"
2006 Aug 01
8
Dumb views?
Hello again! I''ve another "what would you do in this situation" question. You''ve got 6 controllers, one named base. The other 5 controllers extend base. Currently they share one layout. Your layout displays navigation. However, there are two actions inside base for which you do not want navigation displayed (index, new). Do you... a) Add logic to your layout telling
2008 Aug 20
0
Re: Help with RoR partial views
Your partial uses a simple form_for(@product) call. By default that will do a POST to the products/create action, which if it''s successful, does a redirect to products/show/<<id for the new product>> (see the create method in your products_controller.rb file). My advice is to just play around w/rails for a bit & get used to its conventions before you try to bend it to
2006 Apr 27
5
ERb on he command line re: Ruby For Rails book
Hi, I am working thru the Ruby for rails book. On page 30 David Black talks about running erb from the command line i.e. $ erb erbdemo.rb just as you would a normal ruby prog ($ ruby erbdemo.rb) but when I try to do this I get command not found. How do I make this work? I am running Linux (Ubuntu Breezy) Regards, Paul
2008 Oct 16
1
Modularisation: Using helper generating HTML output vs. using partials
Hey, I''ve got a general question: when do I use helper and when I do use partials to modularise certain gui elements? For example: I''ve got a faq list. Each item can be folded and unfolded using ajax. FAQ foo -> question 1 -> question 2 -> question 3 So, I wrote a helper "faq_li_tag(args)" which takes the question and answer for parameters and generates the
2006 Jul 16
1
Helpers for models ?
I have some code that I want to share between models and views. I am making it part of a module in a new file in /lib/ and requiring it where needed (/lib/ being part of the LOAD_PATH). Reasonable ? -- Posted via http://www.ruby-forum.com/.
2006 Aug 15
0
Benchmarking not being included?
I have a problem that''s mystifying me. I have an application that uses edge rails, and I would like it to put the high level performance information in the production logs. Other apps I have deployed with rails 1.1 have production logs that look something like this: Rendering main/index Completed in 0.06379 (15 reqs/sec) | Rendering: 0.02569 (40%) | DB: 0.02510 (39%) | 200 OK
2006 Jun 24
0
Theme generator
Hello, I just downloaded the Theme Generator, I set it up and put, theme ''main'' then I got "undefined method `theme'' for MainController:Class" but, in the readme it dosn''t say to require it or anything what do I do? -- Posted via http://www.ruby-forum.com/.
2006 Mar 22
3
stack level too deep error : Pulling my hairs out
Hello, I''ve changed something in my test application and since I can''t find the cause of the "stack level too deep" raising on every request. I''ve removed almost every part of code and the error still occurs, eg with this url : www.myhost.com/main/index routes.rb (nothing else in this file) map.connect '':controller/:action/:id''
2006 Jan 04
0
Simple print statement (was: recongizing the current controller in views)
All (and kevin), After flying high for a while on Rails things, I''m down to the nitty gritty of Ruby stuff. Messing with vars and printing them out on a web page. I found the controller_path in the API docs; However when putting this in a controller: @test1 = controller_class_name @test2 = controller_name @test3 = controller_path And this in a partial: Test1 <%= @test1