[Rails] Is there any problem extend ApplicationHelper in application controller

2011-11-22 Thread Tom Mac
Hi I have a function in ApplicationHelper say an example def url_needed if current_user.is_staff? home_url else another_url end end And in ApplicationController what I did is def check_for_the_feature flash[:notice] = 'You have no permission to do this.' self.ext

[Rails] how to convert Date to this json format

2011-08-26 Thread Tom Mac
Hi I have to create a json date like {"startDate":"\/Date(1291145744713-0700)\/","endDate":"\/Date(1293824144713-0700)\/"} This is just an example. My case startdate = Time.now-2.day enddate = Time.now I dont know how to convert this to the above format. Please help T

[Rails] how to handle admin section of a saas application

2011-05-23 Thread Tom Mac
Hi Mine is a sass model application. Various companies can register. Each company has there own admin and ordinary staff and respective actions etc. I have implemented this with proper privileges,permissions. This is the way till I could manage. My new requirement is a super admin (he can do func

[Rails] Re: ActiveRecord::Relation

2011-04-07 Thread Tom Mac
Hi Then how can I check that it is not triggering sql. I did not understand it properly. Could you explain more please? Frederick Cheung wrote in post #991438: > On Apr 7, 10:49am, Tom Mac wrote: >> Hi Fred >> Thanks . I tried from sample application also like >> def

[Rails] Re: ActiveRecord::Relation

2011-04-07 Thread Tom Mac
Hi Fred Thanks . I tried from sample application also like def index @articles = Article.where(:hidden => true) puts @articles.inspect - end Here also the query executed. I dont know why. -- Posted via http://www.ruby-forum.com/. -- You received this message

[Rails] Re: ActiveRecord::Relation

2011-04-07 Thread Tom Mac
Hi i am talking exactly about this. Now only I found this https://rails.lighthouseapp.com/projects/8994/tickets/4476-lazy-loading-broken-since-beta3 I am getting this not only in console but application also. Has anything changed in Rails3.0.5? -- Posted via http://www.ruby-forum.com/

[Rails] ActiveRecord::Relation

2011-04-07 Thread Tom Mac
Hi I have just started learning Rails3 (ruby1.92, Rails3.0.5) and watched railscast episode 202. I tried Article.where(:hidden => true) from console. I have a confusion there since the cast says that , the above statement execute query in the view when iterated. I did not understand that. I got

[Rails] Re: How to secure paypal signature, username and password stored in app_config

2011-03-31 Thread Tom Mac
Hi I am using app_config.yml exactly like http://railscasts.com/episodes/143-paypal-security Please help Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group,

[Rails] How to secure paypal signature, username and password stored in app_config

2011-03-31 Thread Tom Mac
Hi I store paypal api username, password and signature as simple text in config/app_config.yml. I would like to know whether this can be protected , than just storing it as text which anybody can read from app_config.yml. Thanks Tom -- Posted via http://www.ruby-forum.com/. -- You received

[Rails] remove .git folder from svn

2011-01-31 Thread Tom Mac
Hi I use svn. I have git clone active merchant to vendor/plugin. This I did with a purpose to commit back my changes. But the problem is when I synchronize with svn it takes more time due to .git folder in vendor/plugins/active_merchant. My question is how can I ignore .git folder as well as .git

[Rails] Re: ActiveRecord::StatementInvalid

2011-01-13 Thread Tom Mac
Thanks for your reply. Meanwhile I have done it. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this

[Rails] Re: ActiveRecord::StatementInvalid

2011-01-13 Thread Tom Mac
> but in terms of getting your > application running can you not just truncate the string to a valid > length before saving the record? Yes that is possible any way not the best. Relating to this two questions. 1) Is there any other gem than mysql. I found ruby-mysql but could not try since

[Rails] ActiveRecord::StatementInvalid

2011-01-12 Thread Tom Mac
Hi I am using rails2.2.2 with mysql5.1. I have a text field 'EmailBody'. And when I try to store data more than 65536 (Say for example 65550) in linux it works properly by truncating it to 65536 characters and save successfully to table. But when I test this same application on a windows machi

[Rails] Re: rvm and phusion passenger

2011-01-06 Thread Tom Mac
Hi Thanks for the reply. I followed http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/ I started with passenger start -a 127.0.0.1 -p 3000 -d And I am getting an error. Complete trace is attached. Please have a look Thanks Attachments: http://www.ruby-forum.

[Rails] rvm and phusion passenger

2011-01-05 Thread Tom Mac
I have two rails applications currently running on systemruby which is version 1.8.6. And I am using phusion passenger with apache to run the applications. My new requirement is to run one of the applications in Ruby1.8.7. For that I have set up 1.8.7 with RVM. But I dont know how to modify my exis

[Rails] paypal chained payment

2011-01-02 Thread Tom Mac
Hi I want to implement paypal chained payment with adaptive payments API. I am totally new to paypal. Kindly guide me to start with. I have heard of gem active merchant. Can I use that for the purpose? Or any other gems? Also please point me to any examples describing adaptive payment with chaine

[Rails] Is this error related to connection pool

2010-12-07 Thread Tom Mac
Hi My environment is ruby 1.8.6 rails 2.2.2 mysql 5.1 windowsXP I have a very lengthy controller action which fetch mail from pop server. But some times I get error. Mainly three error. And I have to restart the application again to remove this errors. But after some time the same

[Rails] Re: phpmyadmin equivalent in ruby

2010-11-23 Thread Tom Mac
Thanks for you all. Hi Michael Pavling you specified > If you *have* to use it, at least put it somewhere obscure *and* use > some extra layer of protection (through htpasswd or similar). Could you please explain it a bit more? Tom -- Posted via http://www.ruby-forum.com/. -- You receive

[Rails] phpmyadmin equivalent in ruby

2010-11-22 Thread Tom Mac
Why I asking this is to avoid php installation on server. Is there any phpmyadmin equivalent in ruby and also can be available as a linux package? Thanks in advance Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby

[Rails] max_allowed_packet mysql

2010-11-18 Thread Tom Mac
Hi I am using rails 2.3.8 with mysql 5.1. In my attachment model the validation was validates_attachment_size :attachment, :less_than => 2.megabytes, :message => "Upload file size should not exceeds 2 MB" And my /etc/my.ini has max_allowed_packet = 16M The above worked perfectly.

[Rails] mail server application

2010-10-06 Thread Tom Mac
I would like to know there is any opensource mail server application in rails. I have found this http://mailr.org/ But seems no recent update to this project. Please suggest an equivalent one Thanks Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you

[Rails] Re: commiting doc folder to svn

2010-09-30 Thread Tom Mac
Hi I was asking about should I commit to svn the folder generated by rake doc:app ie doc/app folder completely -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this g

[Rails] commiting doc folder to svn

2010-09-29 Thread Tom Mac
Hi I would like to know expert opinion on this. Should I commit folders like doc/app into svn? What is the general strategy Thanks Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post

[Rails] receive mail with sendmail

2010-09-16 Thread Tom Mac
Hi Could any one please give links to any blogs (etc) which gives a detailed description on receiving emails to rails application with sendmail. I am using fedora12. I request help on configuring mail server (if needed) or can use mail server of another domain and forward it to my application. Do

[Rails] wild card modal email forwarding to rails application

2010-09-16 Thread Tom Mac
Hi May be a long story. Sorry for that.My requirement as this. I have a saas application. The different people can create accounts. Each account holder can create users under them . An example is during account creation one user gives email as "adm...@mydomain.com'. Then after login to applicatio

[Rails] slow loading application phusion passenger

2010-09-14 Thread Tom Mac
Hi I have successfully used phusion passenger with my rails application. But the problem is it takes more time to load the first page. And also if I load a page and wait for some time then again next time it takes more time to load the page. Why this happens? Please help Thanks -- Posted via ht

[Rails] Re: sending email with attachments

2010-08-30 Thread Tom Mac
Hi A detailed requirement of the above is as I have a message model, message_participant model, and attachments model. The relations are message has_many message_participants message has_many attachments attachment using paperclip I am storing in database it self. I have in hand a mess

[Rails] sending email with attachments

2010-08-29 Thread Tom Mac
Hi Could anyone please give an example of sending mails with attachments in rails using actionmailer? I have a user in users table whose attachments is stored in attachments table it self( Relation is user has_many attachments ; attachment belongs_to user). Sender for example is ad...@example.

[Rails] Re: find does not raise exception

2010-08-25 Thread Tom Mac
Hi Edmond Thanks for your reply. The problem is not that. Even it enters in rescue, it does not render :file => "#{RAILS_ROOT}/public/404.html". But it continues execution and I get problem at @messages = message_thread.messages as nil.messages Thanks Tom -- Posted via http://www.ruby-for

[Rails] find does not raise exception

2010-08-25 Thread Tom Mac
Hi I have the code def index @messages = message_thread.messages end private def message_thread begin current_user.message_threads.find(params[:thread_id]) rescue ActiveRecord::RecordNotFound logger.warn "No permission or thread_id nil" render :file => "#{R

[Rails] Re: help needed to create a complex form

2010-08-18 Thread Tom Mac
Hi Thanks for replying.I could do it partially with the following modifications to my models and views message_thread has_many messages accepts_nested_attributes_for :messages message == belongs_to message_thread has_many :document_messages has_many

[Rails] upgarde from rails 2.3.5 to rails 2.3.8

2010-08-18 Thread Tom Mac
Hi I upgraded my rails application rails 2.3.8 from 2.3.5 like below gem install rails -v=2.3.8 Now in environemnt.rb RAILS_GEM_VERSION changed to '2.3.8'. Now when I tried to a previous migration like rake db:migrate VERSION=20100714122104 I got warning like DEPRECATION WARNING

[Rails] help needed to create a complex form

2010-08-17 Thread Tom Mac
Hi My models are message_thread, message, document (document with attachments I am using paperclip) message_thread has_many messages message == belongs_to message_thread has_many :document_messages has_many :documents, :through => :document_messages do

[Rails] An implementation level question

2010-08-11 Thread Tom Mac
Hi I have a message model and message_participants table. message_participants table because same message goes to various recipients. Messaging between either company to users OR user to company. So an initial design of tables made like messages table --- +---+---

[Rails] attaching multiple files at a time on a has_many through

2010-08-09 Thread Tom Mac
Hi My models are class MessageThread < ActiveRecord::Base has_many :messages accepts_nested_attributes_for :messages end class Message < ActiveRecord::Base has_many :message_participants belongs_to :message_thread has_many :document_messages has_many :documents, :through => :docum

[Rails] upgrading from rails2.3.5 to rails2.3.8

2010-07-27 Thread Tom Mac
Hi Please guide me to upgrade my rails application which is 2.3.5 version to 2.3.8 step by step. Thanks for your help Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group,

[Rails] Re: rails asset cache

2010-07-26 Thread Tom Mac
Hi Could anybody please clarify my doubt? Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from

[Rails] Re: rails asset cache

2010-07-25 Thread Tom Mac
Hi Again I am facing a problem. I am using firefox with firebug.A portion of my code like <%= stylesheet_link_tag "styles","home", :cache => "cache/all" %> Now in my local machine from firebug under net tab I disabled "Browser cache" .Then result I got like GET home http://localhost:3000/hom

[Rails] rails asset cache

2010-07-23 Thread Tom Mac
I have a of line code like <%= stylesheet_link_tag "styles",:cache => "cache/styles" %> And it produces source as config.action_controller.perform_caching = true My concern is what is 1279620123 after question mark(?) above. If such a random number always appended, whether caching in

[Rails] calculate the number of months difference between two dates

2010-06-24 Thread Tom Mac
Please share if there any such easy methods in rails. I have dates like date1 = Date.today date2 = Date.today - 3.months (Example can be anything) Now how to get month difference as 3 (date1 - date2) Thanks for any help Tom -- Posted via http://www.ruby-forum.com/. -- You receive

[Rails] named scope and has_many

2010-06-24 Thread Tom Mac
Hi I have the models User and Payment. The relation between them user has_many payments payment belongs_to user payments table has a field paid_date. Now for finding out the last paid_date for a particular user I did like class payment < ActiveRecord::Base named_scope :last_payment_da

[Rails] papaerclip file name and special characters

2010-06-09 Thread Tom Mac
Hi I have a problem checking the uniquness of filename. My rails controller code is if params[:document]["attachment"] && (current_user.documents.find(:all).map(&:attachment_file_name).include? params[:document]["attachment"].original_filename) flash[:error] = "File already exists"

[Rails] Re:

2010-06-07 Thread Tom Mac
Hi Finally I solved like Add And may I conclude that there is no helper which gives exact raw html like http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrail

[Rails] Re:

2010-06-06 Thread Tom Mac
Hi You are right. But still the problem. Please help if possible Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To

[Rails] Re:

2010-06-04 Thread Tom Mac
Hi Did not get ny reply. Please help. It is urgent Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe f

[Rails]

2010-06-03 Thread Tom Mac
Hi I would like to construct a button like Add And I used the helper button_to_remote for this like <%= button_to_remote("Add", { :url => some_url(@id), :condition => "check_valid()", :with=> "'ids='+user_ids"}, {:class => "form-button2 fixed3"} ) %>

[Rails] STI and controllers

2010-05-25 Thread Tom Mac
Hi This is an implementation question. I have the STI models like Class FileCabinet < ActiveRecord::Base end Class TenantFileCabinet < FileCabinet end Class CompanyFileCabinet < FileCabinet end And file_cabinets table is | id | int(11) | NO | PRI | NULL| auto_increment |

[Rails] Re: attachment_fu and paperclip comparison needed

2010-05-23 Thread Tom Mac
Hi I did not get a reply to this. Any comment please? Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe

[Rails] STI

2010-05-14 Thread Tom Mac
Hi While googling i found this old blog. http://sean-carley.blogspot.com/2006/05/when-rails-needs-clue-single-table.html But the problem specified there still exists with even rails 2.3.5 . Why it is not resolved Any specific cause? Please share your thoughts Thanks Tom -- Posted via htt

[Rails] attachment_fu and paperclip comparison needed

2010-05-13 Thread Tom Mac
Hi Could anybody please give a comparison on which of these to use? For example in attachment_fu documentation I saw files can be stored finally 4 ways like File system Database file Amazon S3 Rackspace (Mosso) Cloud Files Like that many more. So if a get a proper comparison that will

[Rails] Re: sorting a listing page

2010-05-09 Thread Tom Mac
Hi I still could not get an exact choice. I found this http://www.2dconcept.com/jquery-grid-rails-plugin But suppose if have a column like full_name but it is not a db column ( i have db columns firstname and lastname) then what I will do? If anybody has any other choice than please help

[Rails] Re: sorting a listing page

2010-05-07 Thread Tom Mac
Hi In short I am searching the best grid plug/gem in rails Thanks Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. T

[Rails] sorting a listing page

2010-05-06 Thread Tom Mac
Hi I have a list page for users. I am using will_paginate for pagination. So an example is full_name(f_name+l_name) email unit(this an integer colum is user.buildng.unit) Clinton Trone cl...@test.com 2 Evette Pace e...@test.com2 Brett B

[Rails] Re: exception handling

2010-04-26 Thread Tom Mac
Hi Thanks. But how can I handle in code? Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this gr

[Rails] exception handling

2010-04-26 Thread Tom Mac
Hi I have controller edit action like def edit begin @user = User.find(params[:id]) rescue ActiveRecord::RecordNotFound logger.warn "User with id #{current_user.id} tried to edit user with id #{params[:id]}" render :file => "#{RAILS_ROOT}/public/404.html" else --- en

[Rails] Re: date in a textfield

2010-04-15 Thread Tom Mac
Hi > MODEL: > class Contract < ActiveRecord::Base > > def formdate_string > formdate.to_s(:db) > end > > def formdate_string=(fdate_str) > self.formdate = Time.parse(fdate_str) > end > > end This happens when in the new does not get value And as one of the post in the rai

[Rails] Re: persist the same url even if validation fails

2010-04-13 Thread Tom Mac
Hi I could solve it by modifying routes like map.connect '/staff_registration/:code', :controller => :staff, :action => :registration_completion,:conditions => { :method => :put } map.staff_registration '/staff_registration/:code', :controller => 'staff', :action => 'registration' And mo

[Rails] Re: dynamically linking to ajax.googleapis jquery

2010-04-11 Thread Tom Mac
Hi Joe Thanks for your elaborate answer. It was useful Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscr

[Rails] dynamically linking to ajax.googleapis jquery

2010-04-08 Thread Tom Mac
Hi I am using jquery and jqueryui in my application And in layout I use <%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"%> <%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"; %> <%= stylesheet_link_tag "ht

[Rails] has_many :through and named_scope

2010-04-07 Thread Tom Mac
Hi I have the models roles, users and user_roles. The relationship among them is user.r --- user has_many user_roles user has_many roles, :through => :user_roles role.rb === role has_many user_roles role has_many users, :through => :user_roles user_role.rb belongs_to :user b

[Rails] Re: captcha in a belongs_to

2010-04-06 Thread Tom Mac
Hi Anybody please help. This still i can't solve Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from

[Rails] captcha in a belongs_to

2010-04-06 Thread Tom Mac
Hi I am using simple_captcha. I have two models User and Staff. Relation ship are User has_one staff staff belongs_to user Now in the staff edit I have to include a captcha. I did like <% form_for @user, :url => staff_url(@staff), :html => {:method => :put } do |f|%> <%= f.te

[Rails] Re: Re: deciml

2010-04-05 Thread Tom Mac
Hi Thanks for all your reply Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send

[Rails] deciml

2010-04-05 Thread Tom Mac
Hi In my table I have t.decimal :rent, :precision => 12, :scale => 2 But when ever I enter a large value like 1234567890333.465 To the table it is stored as 99.99 I would like to know how active record validation can be applied here? Thanks Tom -- Posted via http:/

[Rails] date in a textfield

2010-04-01 Thread Tom Mac
Hi I have two date fields in table start_date and end_date .There data type are datetime. Now in the view I am accepting values of them as text fields like And I am following RailsCast 32 <%= f.text_field :start_date_string, :value => '', :maxlength => 50 %> <%= f.text_field :end_date_string,

[Rails] Re: To translate this query to railsway

2010-03-30 Thread Tom Mac
Hi Hitesh > User > has_one :membership > has_one :role, :through => :membership > > Role > has_many :memberships > has_many :users, :through => :memberships > has_many :permissions > has_many :privileges, :through => :permissions > > Membership > belongs_to :user > belongs_to :role > > > Priv

[Rails] To translate this query to railsway

2010-03-29 Thread Tom Mac
Hi I have the tables users, roles, memberships( join table between users and roles. Between users and roles there is has_many :through relation ship) privileges, permissions (join table between roles and privileges. Between roles and privileges there is has_many :through relation ship) privil

[Rails] Re: seed_fu and has_many :through

2010-03-29 Thread Tom Mac
Hi Colin Suppose I have the development phases like phase1,phase2, etc. So for example in Phase1 I have to seed data to say table1 (rake db:seed_fu) And it is deployed. Now again in phase2 again I have to seed data to table2 . Then also to sseed data I run rake db:seed_fu But when

[Rails] seed_fu and has_many :through

2010-03-29 Thread Tom Mac
Hi In my application to seed data I am using seed_fu (http://github.com/mbleigh/seed-fu) I have tables roles,privileges and permissions( It joins roles and privileges). Now at application startup I have to seed these tables with data. But during runtime some additionals rows may be added to

[Rails] Re: seed data

2010-03-29 Thread Tom Mac
Hi Thanks for your reply > Could you explain what you're trying to do in a step by step scenario? > This > may helper others on the mailing list to better assist you. What I tried is as my first post. Now just as a test a I did like State.destroy_all State.create(:id => 1,:name => "Alabama

[Rails] Re: seed data

2010-03-28 Thread Tom Mac
Hi So my question is how can I ensure that even after running rake db:seed (rake db:seed_fu) a number of times my primary key ie, id here, does not get modified? Should I need to write an update_id function again? Thanks Tom -- Posted via http://www.ruby-forum.com/. -- You received this

[Rails] seed data

2010-03-26 Thread Tom Mac
Hi I am using seed_fu to seed initial data to tables (http://github.com/mbleigh/seed-fu) . And in db/fixtures/state.rb I have values like (I am filling only two data for simplicity) State.seed_many(:name, :abbr,:fips,:country_id, [ { :name => "Alberta", :abbr => 'AB',:fips => '01', :coun

[Rails] attr_accessor as boolean

2010-03-23 Thread Tom Mac
Hi I have in my user model attr_accessor :no_password_validation_needed with_options :unless => :no_password_validation_needed do |p| p.validates_length_of :password, :minimum => 6 p.validates_confirmation_of :password end And from controller I do @user.no_password_validation_need

[Rails] Re: Saas design considerations

2010-03-23 Thread Tom Mac
hi saljamil > and its children. I used named scopes in the model to pass the user_id > from controller and get back data specific to that user (his org and > children orgs). Send me an email if you need some code examples. I would like to get some code examples. Please send your mailid. M

[Rails] h() method in form partial

2010-03-23 Thread Tom Mac
Hi I have a doubt. Dont know it is valid. Just asking. I am trying to reuse the same partial _form for both new and edit. So from new.html.erb I call partial like <%= render :partial => 'user_fields', :locals => {:f => f}%> and in _user_fields.html.erb an example field as <%= u.label :

[Rails] Re: how to customize logger messages in rails 2.3.5

2010-03-22 Thread Tom Mac
Hi > You can overload call method from Formatter. > > example: > > class Logger >class Formatter > Format = "%s [%s] %s %sn" > def call(severity, time, progname, msg) > Format % [severity, format_datetime(time), progname, msg] > end >end > end > > $LOG.error('This is m

[Rails] how to customize logger messages in rails 2.3.5

2010-03-22 Thread Tom Mac
Hi I would like to know how I can customize logger message format in rails 2.3.5 Thanks in advance Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rub

[Rails] Re: Re: how to specify relationship between these models

2010-03-21 Thread Tom Mac
Hi Lots of thanks for all your reply. What I am finally doing is following. (Is it you people suggested?). I have still problem in creating the view for adding a staff. Please correct me if what I am doing is wrong way. users - name email phone etc staffs -- city

[Rails] Re: how to specify relationship between these models

2010-03-19 Thread Tom Mac
Hi Thanks for your reply. This I have already thought of. But one thing I can't understand is why everything is stored in a single table say users here? Can we store each items for say staff,director etc to there own tables? Or Am I wrong? Tom -- Posted via http://www.ruby-forum.com/. -

[Rails] how to specify relationship between these models

2010-03-19 Thread Tom Mac
Hi I have a user model which I used as authlogic. What I need to implement is I have to add staff also to the system. And I designed tables like users - name email phone etc staffs -- city state user_id My question is is this the right approach? And if yes

[Rails] Re: rerender a page if validation fails

2010-03-17 Thread Tom Mac
Hi I get error when I enter http://localhost:3000/users/1 from url But if it is http://localhost:3000/users/1/edit No problem. So my question is why in the else case it shows in the url http://localhost:3000/users/1 instead of http://localhost:3000/users/1/edit Tom -- Po

[Rails] rerender a page if validation fails

2010-03-17 Thread Tom Mac
Hi I have in routes.rb like map.resources :users Now I am trying to edit a user. What the url shows now is http://localhost:3000/users/1/edit But my problem is , when I click on update button and if validations fail I am re rendering the edit page. And it happens properly. But th

[Rails] Re: Re: xss

2010-03-16 Thread Tom Mac
> > Life is much easier if you just store what they typed and deal with it > when you use it... And again going through the plugin doc I found an example like class Message < ActiveRecord::Base xss_terminate :except => [ :body ] end Means we can exempt some fields from sanitization

[Rails] Re: Re: Logging in Rails

2010-03-16 Thread Tom Mac
Hi Colin Thanks for replying back. One more thing I need to clarify is when to use the different levels for logging? For example say in controller we can write logger.info "some thing" or logger.warn "something" How can we know that we should chose this here say info or warn here?

[Rails] Re: Logging in Rails

2010-03-16 Thread Tom Mac
Hi Thanks for all reply. When googling I saw this http://toolmantim.com/thoughts/logging_rails_to_syslog_with_sysloglogger Since a beginner I am asking what will be the advantage if using above? And also I would like to know what are the latest happenings like this Thanks Tom -- Posted

[Rails] Logging in Rails

2010-03-16 Thread Tom Mac
Hi I dont know much about logging in rails? Could anybody please explain how to do that in a live application? Or point me to any latest links which gives a detailed description of how to do this for different environments in rails? Why I am asking this is, I don't know where to start. But have

[Rails] Re: xss

2010-03-15 Thread Tom Mac
Hi No comments yet! Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to

[Rails] xss

2010-03-15 Thread Tom Mac
Hi http://code.google.com/p/xssterminate/ I have found this rails plugin which automatically removes XSS from models upon saving. This is great. My concern is, which is the best choice, 1) use plugin like this Or 2) allow the content to be entered in to db as it is and later escape it from v

[Rails] Re: config.action_mailer.default_url_options = { :host => }

2010-03-09 Thread Tom Mac
Hi Dieter Your answer, if I undersood correctly is to specify like config.action_mailer.default_url_options = { :host => "localhost:3000" } in enviroment. This is what I do now. But my question is how to make it dynamic. Means some thing like config.action_mailer.default_url_options = {

[Rails] config.action_mailer.default_url_options = { :host => }

2010-03-09 Thread Tom Mac
Hi In my application I have a mail sending part in which a user get mail with a link to activate his account. What I am currently doing is as a part of test I created a staging environment And in config/environments/staging.rb I write like config.action_mailer.default_url_options = { :host => "I

[Rails] Re: Re: to get only the updated fields

2010-03-09 Thread Tom Mac
Hi I solved it as Michael suggested And it was working .But now i notified another issue. That is why reopening the thread. The issue is, even if the validations fail, mail is sent to user (What I need is only if update happens successfully on changed attributes then only mail to be sent) c

[Rails] Re: field_error_proc

2010-03-04 Thread Tom Mac
Hi I can't solve this. could anybody please give a solution? Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To un

[Rails] Re: aliased render

2010-03-03 Thread Tom Mac
I got a solution from another old thread in a different forum like map.login '/login', :controller => 'admin/user_session', :action => 'new', :conditions => { :method => :get } # This line does the trick: map.connect '/login', :controller => 'admin/user_session', :action => 'create', :conditions

[Rails] Re: Re: to get only the updated fields

2010-03-03 Thread Tom Mac
Hi Thank you. I have one more thing to clarify . If I write a before_save filter as you suggested, then will mail be sent when ever there is an update or save to this User model ? That is not what I want if it behaves like that.Please excuse if I am wrong Thanks Tom -- Posted via http://

[Rails] aliased render

2010-03-03 Thread Tom Mac
Hi In my routes.rb I have map.login '/login',:controller => :user_sessions, :action => :new Now I have controller action as def create @user_session = UserSession.new(params[:user_session]) if @user_session.save redirect_to some_url else render :action => :new,:layou

[Rails] Re: access authlogic current_user in actionmailer view

2010-03-03 Thread Tom Mac
Hi I have already tried that. Anyway I could solve it y passing current_user from controller and called that mail sending in model from controller Thanks Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rai

[Rails] Re: to get only the updated fields

2010-03-03 Thread Tom Mac
Hi Conrad Thanks for your reply. But this is not working for update_attributes. What I tried is in update action @user = User.find(params[:id]) if @user.update_attributes(params[:user]) send_mail if @user.changed? #But this is always returns false Not working - else end

[Rails] field_error_proc

2010-03-03 Thread Tom Mac
Hi I have in my environment ActionView::Base.field_error_proc = Proc.new { |html_tag, instance| "#{html_tag}" } It is working perfectly. But what I need is only for the login form I have to change this and need to show only the flash error message. Is this possible. Thanks Tom -- Posted v

[Rails] to get only the updated fields

2010-03-02 Thread Tom Mac
Hi I remember once I read about to get only updated fields from an update_attributes method. Means say I have a model user with name,age,sex etc And when the user updates the information I have to first check whether he actually updated anything(There is a chance that update button from view sim

[Rails] Re: access authlogic current_user in actionmailer view

2010-03-02 Thread Tom Mac
Hi Still I can't solve it.Please help Tom -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this grou

  1   2   >