similar to: setting initial text field values in a form

Displaying 20 results from an estimated 200 matches similar to: "setting initial text field values in a form"

2006 Jun 13
13
Pass infomation between different views and controllers
Hi, I am a rails and ruby nuby :-) How do you pass data between different controllers and views? I have a page ( a quote) that I am editing url ....quote/edit/6 6 id the current id. I then go to a catalog (url....catalog) to add an item to my quote (I do this via a line_item file that the quote reads) I now want to go back to the quote. I have tried this <%= link_to ''Back to
2009 Apr 29
7
problem with nil.user
Hi all, I''ve put new code into my app so that an administrator will have extra privileges (administer users, edit pages). The error is: ''Couldn''t find User without an ID'' So the app is looking for a logged in user when the homepage is accessed. Heres my code: site/index view: <% if is_logged_in? and logged_in_user.has_role?(''Moderator'')
2009 Jun 05
6
rails 2.3.2
Hi all, I am using rails v.2.3.2 and if I put following line to my ApplicationController: include LoginSystem and I moved my login_system.rb to lib folder: module LoginSystem protected def is_logged_in? @logged_in_user = User.find(session[:user]) if session[:user] end def logged_in_user return @logged_in_user if is_logged_in? end def logged_in_user=(user) if
2008 Jan 21
7
undefined method error
Hello everyone, I am following the Practical Rails: Social Networking sites book. In chapter 7 photo gallery I am getting a NoMethodError in Pages#show Showing layouts/_menu.rhtml where line #12 raised: undefined method `new_entry_path'' for #<ActionView::Base:0x52fa56c> Extracted source (around line #12): 9: <% if is_logged_in? %> 10:
2006 Jun 06
5
Functional tests and protected actions
Hello! I have certain methods in my Application Controller, that I need to access. Namely ApplicationController#logged_in_user The problem is, that when I try to access it, I get: NoMethodError: protected method `logged_in_user'' called for #<AdminController> Any ideas how I can circumvent that? Or are functional tests really not suited for any kind of logins and session work?
2006 Mar 02
8
User Authentication
I''m trying to create a simple authentication system but am failing miserably. I''m (sort of) following the "Logging In" chapter of the Agile book. Ideally, any access to http://example.com/publish (and any of its subdirectories) should redirect to http:/example.com/publish/login when there is no valid session user_id. Code so far:
2009 Feb 25
3
Secure but elegant destruction method
Hi,- I am looking for a clean and secure way for an ActiveRecord instance to delete itself. Say I have a User model in my app. Then the destructive action would be /users/user_id/destroy. If this action is not secured by a filter like: (*) before_filter :check_administrator_role, :only => :destroy then any user could potentially log in and start issuing: /users/1/destroy /users/2/destroy .
2006 Apr 07
2
Access instance variables from model?
Can I make my model methods aware of the context (preferably instance variables) where they are run, without having to pass them arguments? The app in question should be time zone aware, so something like user.events[0].starts_in should check against @logged_in_user.now rather than Time.now. I could send the user as an argument (user.events[0].starts_in(:timezoned => @logged_in_user)),
2006 Jun 21
5
newbie - question on radio_buttons
I have a view with a form and i want to be able to process the button selected in a controller - not sure how to do this. The form does not map directly to a model - all I want to do is be able to pass back the selected button and know which one it is. So, i have a form and several radio buttons - the submit (not shown) takes me to the process_answer action where I want to determine which
2006 Jun 26
8
id of last element in a table
Hi, I would like to figure out how to determine what the id of the last element in a table is. Is there an equivalent to the Table.find() method which will tell me the number of elements in a table? also, maybe more importantly, where are the available methods on tables documented? What i am trying to do is to increment the id and work through a table and check whether the id i am currently
2006 Mar 16
4
Handling/Catching Exceptions
Hello! I was wondering, sometimes I raise an exception in my Rails apps, e.g.: raise SecurityError unless @post.user == logged_in_user Now: is there any way to catch that SecurityError exception somewhere and render a custom template? E.g., I want to render ''app/views/content/security_error.rhtml'' Does anyone know how to do this? Thanks a bunch, Rob
2006 Jul 07
2
disabling a layout before calling javascript window.open
Hi, I have some code in which i open a pop up when a user clicks on a link. However, the new popup window comes with the layout of the page on which the user clicked the link. I would like to remove the layout only from the new window which is created with the javascript window.open - any ideas thanks -- Posted via http://www.ruby-forum.com/.
2006 Dec 01
3
Sessions in Layered Dispatching
Can you use sessions in layered dispatching? I used them in direct dispatching without any problems, but switching to layered throws an error (saying session doesn''t exist). Sorry if this is a double post, Google Groups isn''t posting my message for some reason. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this
2006 Jan 29
1
RJS template problem!
hi all, i have the following controller: class UserController < ApplicationController . . . def login @user = User.new(params[:user]) @logged_in_user = @user.try_to_login if @logged_in_user session[:user_id] = @logged_in_user.id else flash[:notice] = "ung&uuml;ltige Daten!" end end . . . end with this rjs template: login.rjs: if @logged_in_user
2008 Jul 17
1
child xxxxx (imap) returned error 83 (Out of memory)
Hi list, > Jul 17 12:15:10 seamus dovecot: IMAP(someone at somehost.org): block_alloc(): Out of memory > Jul 17 12:15:10 seamus dovecot: child 26181 (imap) returned error 83 (Out of memory) I found those two entries in the logs this morning. The system has ample free memory. What's going on? -- martin | http://madduck.net/ | http://two.sentenc.es/ "i wish i hadn't slept
2006 Jan 01
4
Agile book deltas
Are there deltas for the revisions of the PDF version of the Agile book? -- fxn
2002 Nov 27
1
Setting up Red Hat machine on a windows network
Hello, I am setting up a red hat machine on a windows network and i am wondering if the samba application needs to be installed onto the server or weather I would get away with it being installed on the local machine only. Thanks for your help, seamus.
2009 May 20
3
ffmpeg + mp3 convert
Hi all, I am using paperclip plugin to upload mp3''s. Before I save the mp3 I would like to convert it to a smaller size. I am using ffmpeg library and in my Track model I am calling: before_save :convert_mp3 def convert_mp3 system("ffmpeg -i #{mp3.to_file.path} -vn -ar 44100 -ac 2 -ab 64 -f mp3 #{mp3.to_file.path}") end But this fails. Am I missing something?
2006 Jan 13
0
Layout not rendered when render_component used
Hi I''ve got a login action that handles authenticating users, setting cookies and, via its view, displaying an HTML snippet containing a form with username and password fields. It''s called from the main application.rhtml layout so I don''t need to have a seperate page (away from the main site) with a login form. My user model is more-or-less the same as in the Agile RoR
2009 Feb 21
1
undefined method user_id
Basically, Im trying to add comments to photos that other users have uploaded. And Ive encountered an error: NoMethodError in CommentsController#create undefined method `user_id='' for #<Comment:0x4768cd0> C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1857:in `method_missing''