Vikas Gholap | 4 Jul 14:37

problem for authorize.net in service merchant plugin


Hello,

I used service merchant plugin  in my application. using "paypal getway"
it works fine.

But when i tried authorize.net as a getway, it dose not work. It gives
error

StandardError in SubscriptionsController#subscribe
Recurring payment creation error: User authentication failed due to
invalid authentication values.

When i debug the code I think one file (i.e may be
authorizenet_extension.rb) is missing in

"vendor\plugins\service_merchant\recurring_billing\lib\am_extensions"

There is only paypal_extension.rb is present for paypal getway. but not
like "authorize.net_extension.rb" for authorize.net getway.

Am I right?

If the authorizenet_extension.rb is missing, please tell me whether
should I get that file.
Please guide me where I'm doing wrong?

--
--
Thanks,
(Continue reading)

Rajendra Bayana | 4 Jul 12:12

scaffolding


hi , i used the folllwing command to scaffold,

G:\my\webblog>ruby script/generate scaffold webblog id:integer
title:string body
:text created_at:datetime

after when i migrate with the follwing command

rake db:migrate

i got the error as

(in G:/my/webblog)
== 1 CreateWebblogs: migrating
================================================
-- create_table(:webblogs)
rake aborted!
Mysql::Error: You have an error in your SQL syntax; check the manual
that corres
ponds to your MySQL server version for the right syntax to use near
'(11), `titl
e` varchar(255) DEFAULT NULL, `body` text DEFAULT NULL, `created_at` '
at line 1
: CREATE TABLE `webblogs` (`id` int(11) DEFAULT NULL auto_increment
PRIMARY KEY(
11), `title` varchar(255) DEFAULT NULL, `body` text DEFAULT NULL,
`created_at` d
atetime DEFAULT NULL, `updated_at` datetime DEFAULT NULL) ENGINE=InnoDB

(Continue reading)

Learn by Doing | 4 Jul 11:55

save! not allowed after validates_uniqueness


I have this in a model

     validates_uniqueness_of :aspect, :scope => :user_id

In an instance method of the same model I have "save!" but I don't touch
the :aspect attribute in that instance method at all.

Whenever that save! command is run however I get this error:

      ActiveRecord::RecordInvalid: Validation failed:  Aspect has
already been taken

I don't understand.  The validation should not skip the instance from
which the method is called.  Please help.  Thanks.
--

-- 
Posted via http://www.ruby-forum.com/.

Rajkumar Surabhi | 4 Jul 10:51

IOError while rendering and redirecting


HI all,

I am getting IOError while rendering view or redirecting.

If i refresh the page the actual page is displaying.

Please tell me wht is the problem and how to solve the problem.

Regards,

Raju
--

-- 
Posted via http://www.ruby-forum.com/.

Learn by Doing | 4 Jul 10:42

prevent orphan records


If I have

   belongs_to  :user

Do I need to have

   validates_presence_of   :user_id

?

Does Rails validate the presence of :user_id automatically if I have
belongs_to :user?

In other words, does Rails prevent against creating orphan records that
belong to non-existent users?

Thanks.
--

-- 
Posted via http://www.ruby-forum.com/.

Aaron Day | 4 Jul 10:25

Password needed to view atom feed


 I have a before_filter in the controller where the atom feed is coming
from. I want it to check the password when entering that area but not
when a user wants to view the rss feed. Is there a way I can use the
:except here? It's the before_filter on index that makes this happen.
--

-- 
Posted via http://www.ruby-forum.com/.

Dallas | 4 Jul 06:56

Eager loading with find_by_sql


I have a model Tweets, it has_many :teams

I wrote a custom find_by_sql query for tweets (yes i tried all other
approaches) such that I can't eager load the teams.  I collect the ids
and try to fake eager loading myself like so...

team_hash = {}
#collect up the tweet ids
tweet_ids = tweets.collect{|t| t.id}

#find the associated teams
TeamTweet.find(:all, :include => :team, :conditions => "tweet_id IN ("
+ tweet_ids.join(',') +")").each do |tt|
   team_hash[tt.tweet_id] = team_hash[tt.tweet_id] ? team_hash
[tt.tweet_id] << tt.team : [tt.team]
end

#reset the teams attribute
tweets.each do |tweet|
  teams = team_hash[tweet.id] ? team_hash[tweet.id] : []
  tweet.write_attribute(:teams, teams)
  # also tried tweet.teams = teams
end

I'm not sure f there is a better way to do this in general but when I
access tweet.teams it still queries the database for the teams on each
tweet even though I set it already.  I assumed this would be a common
problem for people using find_by_sql but can't find anything.  Any
solutions or suggestions would be greatly appreciated!
(Continue reading)

Grayson Piercee | 4 Jul 05:26

conditions either null or real value


if my category_id could be either nil or a int value, how can I specify
a condition that handles both?

conditions => ["parent_id = ?",params[:category_id]]
conditions => ["parent_id is ?",params[:category_id]]

I'm using acts_as_tree which meets the root levels have no parent_id
(null in SQL)
so if no category_id is passed as a parameter I want it to pull up the
roots, if one is passed, I want it to pull the children of that node.
--

-- 
Posted via http://www.ruby-forum.com/.

Learn by Doing | 4 Jul 05:05

find Composite Primary Keys


I have a problem running find using composite primary keys.  I have the
following models:

Code :   - fold - unfold

   1. class Stat < ActiveRecord::Base
   2.   set_primary_keys :user_id, :score_aspect
   3.   belongs_to       :user

Code :   - fold - unfold

   1. class User < ActiveRecord::Base
   2.   has_many  :stats

Stat.find runs fine when it can find a stat.  But it returns error
instead of "nil", when it cannot find a stat.

Code :   - fold - unfold

   1. >> Stat.find(user, "valid_aspect")
   2. => #<Stat id: 335580687, user_id: 1000, score_aspect:
"valid_aspect" . . .>
   3.
   4.
   5. >> Stat.find(user, "dfsdf")
   6. ActiveRecord::RecordNotFound: Couldn't find all Stats with IDs
([[#<User id: 1000, . . . "dfsdf"]])`stats`.`user_id`=1000 AND
`stats`.`score_aspect`='dfsdf'
   7.   from
(Continue reading)

Rick | 4 Jul 04:18

I'm stumped by this stupid newbie error I'm seeing... trying to figure out where to "look" next... (undefined method xxx_path )


On one of my new.html.erb files backed by a "matches_controller" I'm
getting the error:

undefined method `matches_path' for #<ActionView::Base:0x2cfc748>

I don't understand where to start looking to try to understand why I'm
getting this error. Even if I back everything out of the page and just
have:

<h1>New match</h1>
<% form_for(@match) do |f| %>
<% end %>

I still get the error.

What am I supposed to do to start tracking now where the issue is? Is
it that I'm getting an error message that isn't directly related at
all to the 'matches_path" issue.
Other pages aren't having this issue, so I'm a bit stumped.

I'm a rails newb (but seasoned java person so I have no problem
looking in logs for errors.. but the errors don't seem to be helping
me track down the 'reai' issue.)

Thanks for any direction of what to start looking at (is it maybe an
obscure error in my controller or another page causing the problem?)

Learn by Doing | 4 Jul 03:48

Composite Primary Keys and validates_uniqueness_of


This question regards the Composite Primary Keys gem
(http://compositekeys.rubyforge.org/) :

Once I use set_primary_keys, should I also use

  validates_uniqueness_of to ensure that the composite primary key is
unique and

  attr_readonly to ensure that the attributes in the primary key would
not be overwritten?

Thanks.
--

-- 
Posted via http://www.ruby-forum.com/.


Gmane