[Rails] How to define virtual attribute for date_select drop menu using active model

2012-08-14 Thread Loganathan Sellapa
Hi All,

I am using active model for payment process in my application , i am not
able to add field for date field, since it throws error as below *undefined
method `card_expiration_date(3i)='*.

*In model:
 * include ActiveModel::Validations
  include ActiveModel::Conversion
  extend ActiveModel::Naming*
*

  attr_accessor: card_expiration_date
*In view:*

%=f.date_select :card_expiration_date, :add_month_numbers =
false,:discard_day = true, :start_year = (Date.today.year-10), :end_year
= (Date.today.year+10),:order=[ :month,:year] %


Any help would be appreciated.
regards,
Loganathan
ViewMe http://vizualize.me/loganathan

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] how to do form parameter naming from the form tag?

2012-08-14 Thread Colin Law
On 13 August 2012 22:37, Lille lille.pengu...@gmail.com wrote:
 I would say though that you should use form_for rather than form_tag
 if possible.  So if the form is displaying data for an object then use
 form_for.


 There was no especially good reason to try for this, except I happened to
 have a form that used form_tag and with no instance variable available for
 use with form_for.

 Anyway, let me close this issue, noting that my conclusion is that there is
 no way to get parameter naming with form_tag like from form_for.

As I said, it should work with form_tag and form_for.  What makes you
think that it does not?

By the way, there is no need to send a copy of the email directly to
me, just send it to the list.

Colin

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Re: How can I copy records from one table to another?

2012-08-14 Thread Michael Pavling
On 14 Aug 2012 04:38, ZeroModulus brlafreni...@gmail.com wrote:

 The number of records would vary widely.

 I thought of doing deleted tables because I had already thought of having
an attribute to mark a record as active, but figured I would have to write
an exclusion clause every time.

 Would there be a way to do this without having to write exclusion clauses
for every query?


Have a look at the acts_as_paranoid gem.

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] How to define virtual attribute for date_select drop menu using active model

2012-08-14 Thread Colin Law
On 14 August 2012 07:50, Loganathan Sellapa loganathan...@gmail.com wrote:
 Hi All,

 I am using active model for payment process in my application , i am not
 able to add field for date field, since it throws error as below undefined
 method `card_expiration_date(3i)='.

 In model:
   include ActiveModel::Validations
   include ActiveModel::Conversion
   extend ActiveModel::Naming

   attr_accessor: card_expiration_date

What is the purpose of the line above?  Check the docs for
attr_accessor to see what it does.

Colin


 In view:

 %=f.date_select :card_expiration_date, :add_month_numbers =
 false,:discard_day = true, :start_year = (Date.today.year-10), :end_year
 = (Date.today.year+10),:order=[ :month,:year] %


-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] How to define virtual attribute for date_select drop menu using active model

2012-08-14 Thread Loganathan Sellapa
I thought it would create getter and setter methods for
card_expiration_date  and the active model library would do the rest(such
as creating virtual attributes card_expiration_date(1i),
card_expiration_date(2li),card_expiration_date(3li) for date time attribute(
card_expiration_date), let me know if I am wrong.

regards,
Loganathan
ViewMe http://vizualize.me/loganathan





On Tue, Aug 14, 2012 at 1:06 PM, Colin Law clan...@googlemail.com wrote:

 On 14 August 2012 07:50, Loganathan Sellapa loganathan...@gmail.com
 wrote:
  Hi All,
 
  I am using active model for payment process in my application , i am not
  able to add field for date field, since it throws error as below
 undefined
  method `card_expiration_date(3i)='.
 
  In model:
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
 
attr_accessor: card_expiration_date

 What is the purpose of the line above?  Check the docs for
 attr_accessor to see what it does.

 Colin

 
  In view:
 
  %=f.date_select :card_expiration_date, :add_month_numbers =
  false,:discard_day = true, :start_year = (Date.today.year-10),
 :end_year
  = (Date.today.year+10),:order=[ :month,:year] %
 

 --
 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 group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] How to define virtual attribute for date_select drop menu using active model

2012-08-14 Thread Colin Law
On 14 August 2012 08:44, Loganathan Sellapa loganathan...@gmail.com wrote:
 I thought it would create getter and setter methods for
 card_expiration_date  and the active model library would do the rest(such
 as creating virtual attributes
 card_expiration_date(1i),card_expiration_date(2li),card_expiration_date(3li)
 for date time attribute(card_expiration_date), let me know if I am wrong.

Please don't top post, it makes it difficult to follow the thread.
Insert your reply inline in the previous message.  Thanks.

You don't need to specify att_accessor for fields in the database,
ActiveRecord will supply them automatically.  By providing them
yourself you have disabled the automatic ones.

I guess you are a beginner with Rails so I suggest that you work
through some tutorials to understand the basics.  railstutorial.org is
good and is free to use online.

Colin


 regards,
 Loganathan
 ViewMe





 On Tue, Aug 14, 2012 at 1:06 PM, Colin Law clan...@googlemail.com wrote:

 On 14 August 2012 07:50, Loganathan Sellapa loganathan...@gmail.com
 wrote:
  Hi All,
 
  I am using active model for payment process in my application , i am not
  able to add field for date field, since it throws error as below
  undefined
  method `card_expiration_date(3i)='.
 
  In model:
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
 
attr_accessor: card_expiration_date

 What is the purpose of the line above?  Check the docs for
 attr_accessor to see what it does.

 Colin

 
  In view:
 
  %=f.date_select :card_expiration_date, :add_month_numbers =
  false,:discard_day = true, :start_year = (Date.today.year-10),
  :end_year
  = (Date.today.year+10),:order=[ :month,:year] %
 

 --
 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 group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.



 --
 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 group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] How to define virtual attribute for date_select drop menu using active model

2012-08-14 Thread Loganathan Sellapa
My model* doesn't use Activerecord* ORM, I need to do validation on the
table less model, so I am using the Activemodel library, also I hope the
virtual field are needs to be mentioned as attr_accessor and I am sorry
to mention that the model is table less in previous mail, since I thought
people will understand when I say Activemodel.

regards,
Loganathan
ViewMe http://vizualize.me/loganathan


On Tue, Aug 14, 2012 at 1:30 PM, Colin Law clan...@googlemail.com wrote:

 On 14 August 2012 08:44, Loganathan Sellapa loganathan...@gmail.com
 wrote:
  I thought it would create getter and setter methods for
  card_expiration_date  and the active model library would do the
 rest(such
  as creating virtual attributes
 
 card_expiration_date(1i),card_expiration_date(2li),card_expiration_date(3li)
  for date time attribute(card_expiration_date), let me know if I am wrong.

 Please don't top post, it makes it difficult to follow the thread.
 Insert your reply inline in the previous message.  Thanks.

 You don't need to specify att_accessor for fields in the database,
 ActiveRecord will supply them automatically.  By providing them
 yourself you have disabled the automatic ones.

 I guess you are a beginner with Rails so I suggest that you work
 through some tutorials to understand the basics.  railstutorial.org is
 good and is free to use online.

 Colin

 
  regards,
  Loganathan
  ViewMe
 
 
 
 
 
  On Tue, Aug 14, 2012 at 1:06 PM, Colin Law clan...@googlemail.com
 wrote:
 
  On 14 August 2012 07:50, Loganathan Sellapa loganathan...@gmail.com
  wrote:
   Hi All,
  
   I am using active model for payment process in my application , i am
 not
   able to add field for date field, since it throws error as below
   undefined
   method `card_expiration_date(3i)='.
  
   In model:
 include ActiveModel::Validations
 include ActiveModel::Conversion
 extend ActiveModel::Naming
  
 attr_accessor: card_expiration_date
 
  What is the purpose of the line above?  Check the docs for
  attr_accessor to see what it does.
 
  Colin
 
  
   In view:
  
   %=f.date_select :card_expiration_date, :add_month_numbers =
   false,:discard_day = true, :start_year = (Date.today.year-10),
   :end_year
   = (Date.today.year+10),:order=[ :month,:year] %
  
 
  --
  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 group, send email to
  rubyonrails-talk+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 
 
  --
  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 group, send email to
  rubyonrails-talk+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 

 --
 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 group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] “undefined method `accept' for nil:NilClass”

2012-08-14 Thread news.anand11
I am getting undefined method `accept' for nil:NilClass error while
running db:migrate. My configuration is:

Rails 3.2.8
MySql 5.1.54
OS : win7
ruby : 1.9.2

my gems list command output:

F:\RailsApp\MyAppgem list

*** LOCAL GEMS ***

actionmailer (3.2.8)
actionpack (3.2.8)
activemodel (3.2.8, 3.1.0)
activerecord (3.2.8)
activeresource (3.2.8)
activesupport (3.2.8, 3.1.0)
arel (3.0.2)
bcrypt-ruby (3.0.1 x86-mingw32)
builder (3.0.0)
bundler (1.1.5)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.3)
erubis (2.7.0)
execjs (1.4.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.4)
jquery-rails (2.0.2)
json (1.7.4)
mail (2.4.4)
mime-types (1.19)
minitest (1.6.0)
multi_json (1.3.6)
mysql (2.8.1 x86-mingw32)
mysql2 (0.3.11 x86-mingw32, 0.2.6 x86-mingw32)
polyglot (0.3.3)
rack (1.4.1, 1.3.6)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.8)
railties (3.2.8)
rake (0.9.2.2, 0.8.7)
rdoc (3.12, 2.5.8)
sass (3.2.0)
sass-rails (3.2.5)
sprockets (2.1.3)
thor (0.15.4)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)
uglifier (1.2.7)

I have also copy the %MYSQLPATH%/bin/libmySQL.dll file to %RUBYHOME%/bin
folder.

Can anybody pleas help me to solve this problem?

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] embedded font

2012-08-14 Thread phoe san
I want to add custom fonts in my rails project.

fonts is in assets/stylesheets folder.
In my Css .  I declare font-face :

@font-face
{
font-family: Zawgyi-One;
src: url(/assets/stylesheets/Zawgyi-One.ttf);
}.

ttf is not ok @ ruby on rails ?

How I do ?

Regards,

Phoesan

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Rails authorization system

2012-08-14 Thread Andrew Vit
Note that Devise and CanCan are orthogonal... you can use both, or either.

Authentication is something that doesn't change a lot after it's set up, so 
you might write it once and forget about it. It's good if you want to keep 
it simple. I suppose you might decide to support a new mechanism like OAuth 
or OpenID (for facebook/twitter/google login), and that might be harder to 
add to your own existing system later. Devise is maybe harder to 
understand, but that is the trade-off, it takes care of the complexity for 
you.

One immediate smell I get from Ernie's tutorial is using method_missing for 
roles... I personally wouldn't do that, and 
@user.is_a_user_or_admin_or_superhero_or_demigod_or_chuck_norris? is a bit 
ridiculous. I would pass on this tutorial.

Devise + CanCan is basically plug  play, but you can still customize a 
lot. I would recommend it. Also for security, you are covered by more eyes 
on the code.

Andrew Vit



On Monday, August 13, 2012 8:01:25 PM UTC-7, Ruby-Forum.com User wrote:

 This is more just a question of concepts. I have read extensively in 
 ruby and although many question are still itchy, I am wondering if 
 making my own authentication is the best. A person told me to follow the 
 tutorial on http://ruby.railstutorial.org/chapters/ in which I did. 
 However the authentication system is kinda basic and i am just wondering 
 if I should follow this tutorial 

   - http://erniemiller.org/2008/09/30/easy-role-based-authorization/, 
   - Device 
   - Cancan. 

 I personally don't understand gems and are a black hole for me, hence i 
 prefer making my own authentication system based on that tutorial. 
 Although device and cancan are well though and seem to fit in well. I am 
 wondering if the tutorial of ernie covers most security feature that an 
 authorization system and also by combining it with ( rails book) or 
 should I worry about more security feature or Its so out-of-date that 
 device or cancan should be only my consideration. 

 I am looking for though or suggestion. 
 Thanks in advanced 

 -- 
 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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/p7GPt3FxMoQJ.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Re: How can I copy records from one table to another?

2012-08-14 Thread Andrew Vit
acts_as_paranoid simply adds a deleted_at flag, it doesn't move records to 
a separate table.

Something like acts_as_archive is a better equivalent.

Andrew Vit



On Tuesday, August 14, 2012 12:15:01 AM UTC-7, Michael Pavling wrote:


 On 14 Aug 2012 04:38, ZeroModulus brlafr...@gmail.com javascript: 
 wrote:
 
  The number of records would vary widely.
 
  I thought of doing deleted tables because I had already thought of 
 having an attribute to mark a record as active, but figured I would have to 
 write an exclusion clause every time.
 
  Would there be a way to do this without having to write exclusion 
 clauses for every query?
 

 Have a look at the acts_as_paranoid gem. 


-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/xX8cJgUmv20J.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Re: How can I copy records from one table to another?

2012-08-14 Thread Michael Pavling
On 14 August 2012 11:12, Andrew Vit and...@avit.ca wrote:
 acts_as_paranoid simply adds a deleted_at flag, it doesn't move records to a
 separate table.

It does a *little more* than simply that...

 Something like acts_as_archive is a better equivalent.

The requirement to move them to another table was because the OP
didn't know how to flag records in the same table as deleted and
have them auto-magically ignored by finders, etc.

If the requirement is to archive them (which *isn't* the same as
softly deleting), along with the hassle of managing two sets of
tables... then acts_as_archived could be ideal.

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] “undefined method `accept' for nil:NilClass”

2012-08-14 Thread Colin Law
On 14 August 2012 10:30, news.anand11 news.anan...@gmail.com wrote:
 I am getting undefined method `accept' for nil:NilClass error while
 running db:migrate. My configuration is:

Googling for
rails migrate undefined method `accept' for nil:NilClass
shows many hits with the same issue.  Have you looked to see if any of
those help?

Colin

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] “undefined method `accept' for nil:NilClass”

2012-08-14 Thread news.anand11
no any of them hasn't helpful to me. I have also got the ans on stack
overflow but it hasn't work for me. check this :
http://stackoverflow.com/questions/11946775/undefined-method-accept-for-nilnilclass


On Tue, Aug 14, 2012 at 4:15 PM, Colin Law clan...@googlemail.com wrote:

 On 14 August 2012 10:30, news.anand11 news.anan...@gmail.com wrote:
  I am getting undefined method `accept' for nil:NilClass error while
  running db:migrate. My configuration is:

 Googling for
 rails migrate undefined method `accept' for nil:NilClass
 shows many hits with the same issue.  Have you looked to see if any of
 those help?

 Colin

 --
 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 group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Rails authorization system

2012-08-14 Thread Colin Law
On 14 August 2012 04:01, Jean-Sébastien D. li...@ruby-forum.com wrote:
 This is more just a question of concepts. I have read extensively in
 ruby and although many question are still itchy, I am wondering if
 making my own authentication is the best. A person told me to follow the
 tutorial on http://ruby.railstutorial.org/chapters/ in which I did.
 However the authentication system is kinda basic and i am just wondering
 if I should follow this tutorial

   - http://erniemiller.org/2008/09/30/easy-role-based-authorization/,
   - Device
   - Cancan.

 I personally don't understand gems and are a black hole for me

Gems are just bits of ruby code packaged in a way that makes life easy
for the user.  Rails itself is just a set of gems.  Look in the file
Gemfile.lock in your application and you will see all the gems you are
already using.  You will waste a lot of time if you do not build on
the shoulders of those who have come before.  Spend a small amount of
time learning about gems such as cancan and you will progress much
more rapidly.

Colin

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] “undefined method `accept' for nil:NilClass”

2012-08-14 Thread Colin Law
On 14 August 2012 12:01, news.anand11 news.anan...@gmail.com wrote:
 no any of them hasn't helpful to me. I have also got the ans on stack
 overflow but it hasn't work for me. check this :
 http://stackoverflow.com/questions/11946775/undefined-method-accept-for-nilnilclass

Please don't top post, it makes it difficult to follow the thread.
Insert your replies inline the previous message.  Thanks.

Does the app work ok apart from not being able to run a particular migration?

Do other apps work ok?

Can you post the files Gemfile and Gemfile.lock

Colin


 On Tue, Aug 14, 2012 at 4:15 PM, Colin Law clan...@googlemail.com wrote:

 On 14 August 2012 10:30, news.anand11 news.anan...@gmail.com wrote:
  I am getting undefined method `accept' for nil:NilClass error while
  running db:migrate. My configuration is:

 Googling for
 rails migrate undefined method `accept' for nil:NilClass
 shows many hits with the same issue.  Have you looked to see if any of
 those help?

 Colin

 --
 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 group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.



 --
 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 group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] “undefined method `accept' for nil:NilClass”

2012-08-14 Thread Colin Law
On 14 August 2012 12:14, Colin Law clan...@googlemail.com wrote:
 On 14 August 2012 12:01, news.anand11 news.anan...@gmail.com wrote:
 no any of them hasn't helpful to me. I have also got the ans on stack
 overflow but it hasn't work for me. check this :
 http://stackoverflow.com/questions/11946775/undefined-method-accept-for-nilnilclass

 Please don't top post, it makes it difficult to follow the thread.
 Insert your replies inline the previous message.  Thanks.

 Does the app work ok apart from not being able to run a particular migration?

 Do other apps work ok?

 Can you post the files Gemfile and Gemfile.lock

Also what happens when you run
bundle update mysql2
as suggested by others (post the output of the update command here).

Colin

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] validates_format_of :message not working, validates_length_of :message is working

2012-08-14 Thread tomkins
I'm using validates_format_of and the validation I want to do works, but I 
can't get an error message to be displayed if the data is invalid:
validates_format_of :mobile, :with = /\A[\+0-9]+\Z/, :message =  - Wrong

I have another validation some where else that does display the error 
message:  - Name is too long
validates_length_of :name, :within = 5..40, :too_long =  - Name is too 
long,

validates_length_of :name, :within = 1..50, :message = Broken  *-- 
This also works but not for validates_format_of*

Any ideas?
Thanks.

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/7jPE6lNPYBEJ.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] validates_format_of :message not working, validates_length_of :message is working

2012-08-14 Thread Colin Law
On 14 August 2012 13:31, tomkins j.tomk...@live.com wrote:
 I'm using validates_format_of and the validation I want to do works, but I
 can't get an error message to be displayed if the data is invalid:
 validates_format_of :mobile, :with = /\A[\+0-9]+\Z/, :message =  - Wrong

 I have another validation some where else that does display the error
 message:  - Name is too long
 validates_length_of :name, :within = 5..40, :too_long =  - Name is too
 long,

 validates_length_of :name, :within = 1..50, :message = Broken  --
 This also works but not for validates_format_of

You say that you have an example of validates_length_of somewhere
else that /does/ work.  Are you sure that it is not the somewhere
else that is significant.  Try replacing the validates_length_of that
is working with a validates_format_of and see if you then get the
message.  Also try replacing the format validation that does not show
the error with a validates_length_of.

Colin

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] validates_format_of :message not working, validates_length_of :message is working

2012-08-14 Thread tomkins
I tried what you suggested and I got the error message with 
validates_format_of where validates_length_of worked, and length_of didn't 
work where my format_of wasn't working. So it looks like the somwhere 
else is significant, but I cant see any obvious differences between the 
two models, any suggestions?

Thanks for the help Colin.

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/ocNLoXufElwJ.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] testing Rails

2012-08-14 Thread sameena Khan
Ok ill make sure that i go for updated tutorial

On Sat, Aug 11, 2012 at 12:03 PM, Colin Law clan...@googlemail.com wrote:

 On 11 August 2012 06:26, sameena Khan emailtosameenak...@gmail.com
 wrote:
  no am running 2.3.8

 Just be aware then that following a tutorial that does not match the
 version of rails you are using can be difficult, as whenever something
 does not work you do not know whether you have done something wrong or
 it is just that the tutorial is wrong for your version.  You might be
 better following an up to date tutorial such as railstutorial.org,
 which is free to use online (and installing the appropriate version of
 rails obviously).

 Colin

 
  On Fri, Aug 10, 2012 at 11:00 PM, Hassan Schroeder
  hassan.schroe...@gmail.com wrote:
 
  On Fri, Aug 10, 2012 at 6:32 AM, Khan emailtosameenak...@gmail.com
  wrote:
   hi all im trying to follow this link
  
 http://www.tutorialspoint.com/ruby-on-rails-2.1/rails-unit-testing.htm
   to
   learn testing. i got this error
undefined method `fixtures' for BookControllerTest:Class
   (NoMethodError)
 
  And, for whatever reason, you really are running Rails 2.1 ??
 
  --
  Hassan Schroeder  hassan.schroe...@gmail.com
  http://about.me/hassanschroeder
  twitter: @hassan
 
  --
  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 group, send email to
  rubyonrails-talk+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 
 
  --
  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 group, send email to
  rubyonrails-talk+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 

 --
 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 group, send email to
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] validates_format_of :message not working, validates_length_of :message is working

2012-08-14 Thread tomkins
I fixed it, I was missing an error-messages tag in my edit code for the 
page that was not working.

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/keaoGUocgQUJ.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Rails session ID

2012-08-14 Thread Tim Slattery
I'm trying to retrieve the session ID in rails. I found a web page
that said to use

session.session_id

But when I do that, I get:

undefined method `session_id' for
#Rack::Session::Abstract::SessionHash:0x2e14c5

What do I need to do?

-- 
Tim Slattery
slatter...@bls.gov

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] embedded font

2012-08-14 Thread Rob Biedenharn

On Aug 14, 2012, at 5:32 AM, phoe san wrote:

 I want to add custom fonts in my rails project.
 
 fonts is in assets/stylesheets folder.
 In my Css .  I declare font-face :
 
 @font-face
 {
 font-family: Zawgyi-One;
 src: url(/assets/stylesheets/Zawgyi-One.ttf);
 }.

src: url('Zawgyi-one.ttf');

that's all you need to find the file.
Alternatively, '/assets/Zawgyi-one.ttf' but not with the stylesheets/ subdir 
specified. That's just how the asset pipeline searches.

-Rov

 
 ttf is not ok @ ruby on rails ?
 
 How I do ?
 
 Regards,
 
 Phoesan
 
 -- 
 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 group, send email to 
 rubyonrails-talk+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
 
 

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Rails session ID

2012-08-14 Thread tomkins
Try request.session_options[:id]

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/gIAIeyQI27wJ.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Rails] Rails session ID

2012-08-14 Thread Hassan Schroeder
On Tue, Aug 14, 2012 at 7:59 AM, Tim Slattery slatter...@bls.gov wrote:
 I'm trying to retrieve the session ID in rails. I found a web page
 that said to use

 session.session_id

 But when I do that, I get:

 undefined method `session_id' for
 #Rack::Session::Abstract::SessionHash:0x2e14c5

 What do I need to do?

Show the code that's causing that error message, plus the versions
of both Ruby and Rails. At least for starters :-)

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Re: Hello World works on Mongrel but not in Passenger (Error 500), and nothing in the logs?

2012-08-14 Thread Leon V.
Just have to say thank you for this post.
I have Ubuntu 12.04 LTS and have been trying to learn ruby on rails and 
this has been something I am stuck on now for 2 days. :) RAILS_ENV 
helped, but did not solve it for me yet.

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Rails] Devise access customer information without password

2012-08-14 Thread Jean-Sébastien D.
I am trying to customize my account with devise. However I do not want
to provide a confirmation password on every details. Therefore I have
created a new controller has mentionned on the following tutorial:
https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-edit-their-account-without-providing-a-password.

This seem to work, however i have different sections such has follow

General
Security
Interest
Each section render a new form in Settings/_general.html.erb ( partial
renders ) Here how security looks

%= form_for(@customer) do |f| %
fieldset
div class=cus
%= f.label :email %
%= f.text_field :email %
/div
div class=customer_edit_confirmation
%= f.label :email_confirmation, Confirm Password %
%= f.text_field :email_confirmation %
/div
/fieldset
div class=customer_edit_button
%= f.submit Save changes, class: button_accept %
/div
% end %
However when seeing the view at

http://localhost:3000/settings/1/edit#account
I get the following errors

NoMethodError in Settings#edit
Showing /home/jean/rail/voyxe/app/views/settings/_email.html.erb where
line #1 raised:
undefined method `customer_path' for ##Class:0xb49b1838:0xb49b0244
Extracted source (around line #1):

1: %= form_for(@customer) do |f| %
2:  fieldset
3:  div class=cus
4:  %= f.label :email %
I don't understand where customer_path his from. Also an extra how
should i define a safe and secure path to access
settings/current_customer.id/edit in the route.rb file.

Thanks in advance!!!

-- 
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 group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.