[Rails] Re: accepts nest attributes attr_accessible
Why does Child even have the family_id attribute? Can't you get the child's family through it's person (parent)? Unless the child can belong to a different family than the person, this is an unnecessary association. Anyway, that doesn't really answer the question. accepts_nested_atrributes_for and attr_protected on the foreign keys doesn't work together. My question is: Why are you putting attr_protected on the foreign_keys? To prevent users from being able to move a child to a different parent when editing its attributes? If so, I recommend you use attr_readonly instead. On May 19, 5:09 am, brianp brian.o.pea...@gmail.com wrote: Hey, Just going over some of the accepts of accepts_nested_attributes_for attr_accessible. I found with the form and models I've been working on it would be great if I could use accepts_nested_attribtues but I want to propose my case where I just can't make it work. And for secretory reasons wonder where it would ever work for that matter. So below. We have a household setup. We would have a Family object with an id. Now if we were to create one person for the family we could do it easily with: @family = Family.new @family.persons.new(params[person]) But what if we wanted to add a person and a child at the same time via nested parameters? We won't be able to. As the childs family_id field is protected we won't be able to mass assign with the nested parameters. I can't think of a time I would ever be creating a completely open object that wouldn't have a single protected parameter. So when do the nested_attributes come in handy besides when your model is un-secure? (This is just me learning there very well might be perfect places for this, I am just wondering where) class Person ActiveRecord::Base validates_presence_of :name, :family_id has_many :children belongs_to :family accepts_nested_attributes_for :children attr_accessible :name end class Child ActiveRecord::Base belongs_to :person belongs_to :family validates_presence_of :name, :family_id attr_accessible :name end class Family ActiveRecord::Base has_many :persons has_many :children (childs?) attr_protected :id end cheers, brianp -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Fwd: {MUGH} Visual Studio 2010 Training Course And Video Tutorials - torrent
http://rapidlinks007.blogspot.com/ http://rapidlinks007.blogspot.com/ http://rapidlinks007.blogspot.com/ http://rapidlinks007.blogspot.com/ http://rapidlinks007.blogspot.com/ http://rapidlinks007.blogspot.com/ Visual Studio 2010 Training Course And Video Tutorials Download torrent --- *Visual Studio 2010 Training Course And Video Tutorials * http://rapidlinks007.blogspot.com/ http://rapidlinks007.blogspot.com/ http://rapidlinks007.blogspot.com/http://rapidlinks007.blogspot.com/http://rapidlinks007.blogspot.com/http://rapidlinks007.blogspot.com/ http://rapidlinks007.blogspot.com/http://rapidlinks007.blogspot.com/http://rapidlinks007.blogspot.com/http://rapidlinks007.blogspot.com/ http://rapidlinks007.blogspot.com/http://rapidlinks007.blogspot.com/http://rapidlinks007.blogspot.com/http://rapidlinks007.blogspot.com/ http://rapidlinks007.blogspot.com/ http://rapidlinks007.blogspot.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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] observe_field not working on dependeng collection_select
Setup: I have 3 drop downs generated by collection_select, where in the next drop down's option values are dependent on which option value was selected in the previous drop down. This is done using observe_field. e.g. country = state = city Here's the code: %div .label Grading Scheme Select - Tier 1 = collection_select (:grading_scheme, :id, GradingScheme.all, :id, :name) = observe_field('grading_scheme_id', :update = 'parent_div', :frequency = 0.5, :url = {:controller = 'grading_schemes', :action = 'filter_parents'}, :with = 'grading_scheme_id') %div .label Tier 2 #parent_div = collection_select (:grade_layer, :id, @parents, :id, :name) = observe_field('grade_layer_id', :update = 'child_div', :frequency = 0.5, :url = {:controller = 'grading_schemes', :action = 'filter_children'}, :with = 'id') %div .label Tier 3 #child_div = collection_select (:grade_layer, :id, @children, :id, :name) Initially the observe_field would work on updating child_div (Tier 3)whenever I select a different item in Tier 2. If I select a grading scheme in Tier 1, Tier 2 will update its list. However if i select a new item in that updated list in Tier 2, Tier 3 will not update. I've checked my local server, and during those occassions that Tier 3 doesn't update i find that ajax isn't producing any calls. I hope someone can help me out on this. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Facebook, authlogic, and OAuth2
I'm working on a new version of authlogic_oauth that will use oauth2... I think it's what you are searching for... It will be released at the end of the week, keep eyes on http://github.com/potomak On May 8, 3:52 am, Alex a...@liivid.com wrote: Rpx might be good for some people. It's a single sign-on service that you pay a nominal fee to use. Doesn't fit the bill for me. Thanks. On May 7, 1:41 am, swetha swetha.angul...@gmail.com wrote: Yes ,working with authlogic you can use authlogic_rpx gem to make your application login usingfacebookor anyothers. http://github.com/tardate/rails-authlogic-rpx-sample For rpxwww.rpx.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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] ajax on load?
On 19 May 2010, at 06:33, badnaam wrote: I have a form with a select box and there is a div under the select box that gets populated with data collected via ajax, based on the value selected in the select box. I use an observe field to accomplish this. It all work pretty well except, let's say, the form gets submitted (with a value in the select box) and for some reason the validation fails and after the page refresh( the form submission isnt ajax), the select box keeps the value that had been selected, however, since the div underneath only gets populated and shown on a change event, is hidden. I would like it to be showing if there is already a value in the select box. one thing I can do is simply make an ajax call when the page loads and populate/show the div, but it would look awkward (the ajax requests show a shadow box type progress bar, this is a requirement). Is there a better way to do this? Since you have the value in your controller and you simply rerender the same views, make your views more intelligent and render the appropriate data at page render right away. Bad code, but just so you get the idea % form_for @record do |f| % % f.select :some_id % ... % end % % if @record @record.some_id % render view for value with some_id % else % render default view without any value % end % Best regards Peter De Berdt -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: validation on association create
You need to add a bang to the create methods for the addresses so that an exception is raised. Rollbacks only happen if an exception is raised. ActiveRecord::Base.transaction do # (...) @dealer.addresses.create!(params[:mailing_address]) @dealer.addresses.create!(params[:billing_address]) end Or you could wait with saving the dealer until all it's children have been initiated On May 19, 7:46 am, inkling n...@inventric.com wrote: Can you supply the Dealer and User model validations so we can see what they are doing? When you say If the params for the adresses are blank (not valid) or just not valid the objects should not be created and neither should the user or dealer then this wouldn't even work: @dealer = Dealer.new(params[:dealer]) @dealer.save! Since you are asking a dealer record to save but an address hasn't been added to it yet. That should bomb out regardless of params[:mailing_address] being blank or not with what you said and what you have written here. On May 18, 6:21 pm, brianp brian.o.pea...@gmail.com wrote: Hey I'm having the worst time with 1 block of my app lol. I have an address model with many validations. I run this code on a 4 model form. If the params for the adresses are blank (not valid) or just not valid the objects should not be created and neither should the user or dealer. But both the user and dealer are being saved and the addresses are throwing no validation errors. I know the model is valid as i've unit tested it thoroughly. Why are the validations not being processed on create. I've read the differences for new-vs-create-vs-build but it sounds like build associations should run validations. ActiveRecord::Base.transaction do params[:mailing_address] ||= [] params[:billing_address] ||= [] @dealer = Dealer.new(params[:dealer]) @dealer.save! @user = �...@dealer.users.new(params[:user]) @user.roles Role.find(3) @user.save! @dealer.addresses.create(params[:mailing_address]) @dealer.addresses.create(params[:billing_address]) end cheers, brianp -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Rails, Paperclip and SWFupload ...
On 19 May 2010, at 00:08, Philip Hallstrom wrote: Good to know. That won't help with the authenticity token though... Indeed, our swfuploads are completely separated into reusable Javascript objects, so I didn't think of it anymore. Note to self: don't answer mailing list replies while half asleep :-) Best regards Peter De Berdt -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Self Creating edit page?
On May 19, 2:36 am, brianp brian.o.pea...@gmail.com wrote: BUT the page gets rendered as an edit_dealer_id page. with a new hidden field telling the form to submit via put method. I dont really unserstand what you're saying. What are you expecting to get rendered, and what is actually getting rendered? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: HABTM Blank Join table
If ActiveRecord were to know that it's supposed to create an habtm association to another object simply because a foreign_key is present in the attributes hash of the new object, then I think that would create a lot of overhead in the create method, and it's a bit too much magic in my opinion. On every create it would need to check the attributes hash for *_id attributes, then check if any habtm associations matches that, and if so create the record in the join table. Or a reverse version of that where it checks for habtm relations first. It's possible but that's not how it has been implemented. On May 18, 10:09 pm, brianp brian.o.pea...@gmail.com wrote: Hey Sharagoz, Thanks a lot. It worked exactly as desired. Now I was lead to believe that the habtm relationship would be created automagically when the user object is created. Why is it we had to explicitly define it like this? Thanks a lot! -brianp On May 18, 5:48 am, Sharagoz shara...@gmail.com wrote: I dont use HABTM much myself, however I dont think this line will work: @user = �...@dealer.users.create(params[:user].merge(:role_id = 3) Try something like this instead: @dealer = Dealer.create(params[:dealer]) @user = �...@dealer.users.new(params[:user]) @user.roles Role.find(3) @user.save On May 18, 12:22 pm, brianp brian.o.pea...@gmail.com wrote: Based of the declaritive_authorization railscast I've set up a roles table containing 3 role types. A user table and a roles_users table. No matter what I do the join table is always empty. DB: create_table roles, :force = true do |t| t.string role_type t.datetime created_at t.datetime updated_at end create_table roles_users, :id = false, :force = true do |t| t.integer role_id t.integer user_id end add_index roles_users, [role_id], :name = index_roles_users_on_role_id add_index roles_users, [user_id], :name = index_roles_users_on_user_id create_table users, :force = true do |t| t.string first_name, :null = false t.string middle_name t.string last_name, :null = false t.string email, :null = false t.string dealer_id, :null = false role.rb model: class Role ActiveRecord::Base has_and_belongs_to_many :users attr_protected :role_type end user.rb model: class User ActiveRecord::Base acts_as_authentic do |c| c.logged_in_timeout = 10.minutes c.login_field = :email end has_and_belongs_to_many :roles belongs_to :dealer def role_symbols roles.map do |file| role.name_underscore.to_sym end end attr_accessible :email, :password, :password_confirmation, :first_name, :middle_name, :last_name end The user is being created here: �...@dealer = Dealer.new(params[:dealer]) �...@dealer.save! �...@user = �...@dealer.users.create(params[:user].merge(:role_id = 3) �...@dealer.addresses.create(params[:mailing_address]) Every field is created without error except the join table is left blank always. If i call: @user.role.create it will successfully create a new role (with a blank name which is bad) and a join table row. Other then that the join table is always empty. Any suggestions. I've run out of things to try. cheers, brianp -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at
[Rails] customized form_for in ApplicationHelper
hello, I want to make a table within a form by making a new form_tag. The following code in ApplicationHelper fails: def tabular_form_for(name, object = nil, options = nil, proc) concat(table, proc.binding) form_for(name, object, (options||{}).merge(:builder = TabularFormBuilder), proc) concat(/table, proc.binding) end But using this tag in my view, I get errors with my :errors, :name fields of the form. Any ideas how to make this custom tag work? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] customized form_for in ApplicationHelper
hello, I want to make a table within a form by making a new form_tag. The following code in ApplicationHelper fails: def tabular_form_for(name, object = nil, options = nil, proc) concat(table, proc.binding) form_for(name, object, (options||{}).merge(:builder = TabularFormBuilder), proc) concat(/table, proc.binding) end But using this tag in my view, I get errors with my :errors, :name fields of the form. Any ideas how to make this custom tag work? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Activerecord association design advice
Hi guys. So I have a few models: Concept, Entity, Dimension, Rating, User and Fact 1) Concepts can have many dimensions and many entities and many facts. 2) Concepts may share dimensions, but not entities or facts (so the Concept universities can share the Dimension quality but not the Fact num_students. 3) A rating is determined by allowing a user to rate each dimension defined over the concept the entity belongs to. I'm trying to design the relationships on paper before starting, and I thought I'd run it by you guys for suggestions, improvements, advice, etc (I'm quite new to rails and ruby). def Dimension has_and_belongs_to_many :concepts # for the ratings table has_many :ratings has_many :entities, :through = :ratings has_many :users, :through = :ratings def Fact def Entity # for the ratings table has_many :ratings has_many :dimensions, :through = :ratings has_many :users, :through = :ratings def Concept has_and_belongs_to_many :dimensions has_many :entities, :dependent = :destroy has_many :facts, :dependent = :destroy def User # for the ratings table has_many :ratings has_many :dimensions, :through = :ratings has_many :entities, :through = ratings def Rating # the ratings table also has a value field when a user rates an entity's dimension belongs_to :dimensions belongs_to :users belongs_to :entities Thanks in advance -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Unit Test newbie problem
Thanks for your help. My faith the Unit Test *really* works is strengthening :-) On May 18, 12:56 am, frogstarr78 frogstar...@gmail.com wrote: The problem is that the function crud_views_as_a_string is not defined (GenModCRUD.rb:22:` def crud_views_as_a_string') to take an argument. But in your test you are calling it with an argument :string (TestGMC.rb:12: `crud_views_as_a_string(:string)' I'm not sure what you're testing, but to simply remove the error, you would want TestGMC.rb:12 line to read: assert_equal( edit, index, new, show, crud_views_as_a_string(), Surprise) On May 16, 8:43 pm, RichardOnRails richarddummymailbox58...@uscomputergurus.com wrote: Hi All, I got a set of tests for a Ruby app. The first fails unexpectedly (wrong number of args). I added code to show that the app works as I think it should. Any ideas? The code is below: I'm running: Rails 2.3.5, Ruby 1.8.6, WinXP-Pro/SP3, Firefox 3.6.2, Firebug 1.5.3, MySQL 5.0.37-community-nt, Mongrel, Apache HTTP Server 2.2.15 Thanks in advance, Richard # GenModCRUD.rb The Program # module GMC_mod # The standard views (in app.views) in alphabetical order # for any DB table :private def crud_views(type) case type when :string s = %w[edit index new show].join(, ) when :symbols s = [:editm, :index, :new ,:show] puts s else raise 'Invalid arg for crud_views: %s' % type end s end :public def crud_views_as_a_string crud_views(:string) end def crud_views_as_a_symbols_array crud_views(:symbols) end end class InlineTest include GMC_mod end t = InlineTest.new puts t.crud_views_as_a_string.inspect # = edit, index, new, show # GenModCRUD.rb The Test # require 'test/unit' require 'GenModCRUD' class MyTests Test::Unit::TestCase include GMC_mod def test_001_crud_views_as_a_string assert_equal( edit, index, new, show, crud_views_as_a_string(:string), Surprise) end end The Results edit, index, new, show Loaded suite TestGMC Started E Finished in 0.0 seconds. 1) Error: test_001_crud_views_as_a_string(MyTests): ArgumentError: wrong number of arguments (1 for 0) TestGMC.rb:12:in `crud_views_as_a_string' TestGMC.rb:12:in `test_001_crud_views_as_a_string' 1 tests, 0 assertions, 0 failures, 1 errors Exit code: 1 -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] define environment for rake db:seed
How do you define which version of the database is populated via the new default seed process? Running this: rake db:seed runs the code in seed.rb in the development environment and therefore loads the seed data into the development database. What is the syntax to use seed to populate the production database? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Table with dynamic content
I want to create a table displaying image thumbnails, 3 per row. Can I use an if loop to create the tr tags? or is this better acheived with css? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Activerecord association design advice
To me it looks like you are doing way too much abstraction here. With model names like Concept, Entity and Dimension it is going to be extremly hard for anybody else to wrap their heads around what exactly you are trying to design. At least I can't do it, and hence I cant really give any advice either. On May 19, 1:49 pm, Ali ali.akhtarz...@gmail.com wrote: Hi guys. So I have a few models: Concept, Entity, Dimension, Rating, User and Fact 1) Concepts can have many dimensions and many entities and many facts. 2) Concepts may share dimensions, but not entities or facts (so the Concept universities can share the Dimension quality but not the Fact num_students. 3) A rating is determined by allowing a user to rate each dimension defined over the concept the entity belongs to. I'm trying to design the relationships on paper before starting, and I thought I'd run it by you guys for suggestions, improvements, advice, etc (I'm quite new to rails and ruby). def Dimension has_and_belongs_to_many :concepts # for the ratings table has_many :ratings has_many :entities, :through = :ratings has_many :users, :through = :ratings def Fact def Entity # for the ratings table has_many :ratings has_many :dimensions, :through = :ratings has_many :users, :through = :ratings def Concept has_and_belongs_to_many :dimensions has_many :entities, :dependent = :destroy has_many :facts, :dependent = :destroy def User # for the ratings table has_many :ratings has_many :dimensions, :through = :ratings has_many :entities, :through = ratings def Rating # the ratings table also has a value field when a user rates an entity's dimension belongs_to :dimensions belongs_to :users belongs_to :entities Thanks in advance -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Table with dynamic content
On 19 May 2010 13:20, the batman li...@ruby-forum.com wrote: I want to create a table displaying image thumbnails, 3 per row. Can I use an if loop to create the tr tags? if doesn't produce a loop - it's just a conditional check. Assuming your images are stored in an array, you can use any of a number of methods to loop them. * you could do .each_with_index and then start a new row on mod-3 of the index * you could use .each_slice(3) and iterate the returned array of three * you could (if you like it clunky) just use .each maintain your own counter and do your next row operations when it gets to a multiple of 3 http://www.ruby-doc.org/core/classes/Enumerable.html or is this better acheived with css? Probably (for all sorts of tables are for tabular data reasons). But the problem of working out how to tell the element it's a new row will be very similar to using a table (unless you rely on overflow wrapping in a fixed-size container). -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] [Event] Acts As Conference 2010 - We Want You To Speak!
Hi everyone, The call for proposals is open for Acts as Conference 2010. This year we're focusing on software craftsmanship, Agile, web development, and of course the leading edge in the Ruby on Rails world. We're going even bigger than last year, with a full day of hands-on workshops, and two days of sessions. Each day we'll have conference Internet, breakfast, lunch, morning and afternoon breaks, as well as a speaker/ sponsor dinner. Proposals are already coming in, and tickets are being sold. Get all the details and submit your workshop or session proposal today: http://www.actsasconference.com/submit-a-workshop-or-session-for-aac2010/ See you there. Sincerely, Robert Dempsey http://www.actsasconference.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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: ActiveRecord / Nested Attributes create missing associat
one more info: the code above works when I create a new parent (and either create a new child or choose an existing one in the nested form). The code doesn't work when I edit the model and choose an existing child record (the association won't be created), any hints? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Table with dynamic content
* you could (if you like it clunky) just use .each maintain your own counter and do your next row operations when it gets to a multiple of 3 I think that's what I was trying to do, though I didn't know how to get a new table row was I on the right track? table % @photos.each do |photo| % % count = 0 % % while count = 3 % tr td%= link_to image_tag(photo.image.url(:thumb)), photo %/td % count += 1 % tr/ % end % ... -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] q: belongs_to build
hi invite belongs_to location location has_one invite background: location is not set at the time of the invite... i = invite.find(1) how do i build the location and update the invite (location_id) in one go? (build doesnt set the foreign key for me..) loc = i.build_location(:title='test') loc.save! create a location, but fk is missing... thx -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: OneLogin releases SAML for Ruby
None of those will give you SAML identity provider functionality. They are both SAML service provider interfaces. - Christian On May 18, 6:32 pm, Reynard reynar...@gmail.com wrote: Hi there, thanks for releasing this toolkit. Does supports both service provider and identity provider initiated web SSO means you can run identity provider service with this toolkit? Also, does anyone have experience with saml2ruby gem?http://rubygems.org/gems/saml2ruby Looks like these are the only 2samllibraries I can find, and both has limited documentation. If I need to implement identity provider service which library is best to use? thanks! - reynard On May 3, 8:58 pm, Thomas Pedersen tho...@onelog.in wrote: We have just published a neat little toolkit for those of you who are interested inSAML-enabling your enterprise application.SAMLis a standards-based single sign-on protocol, which allows an identity provider to securely log users into an application without a password. Some of the advantages ofSAMLthat you avoid passwords altogether and can centralize access control at your identity provider. OneLogin'sSAMLkit supports both service provider and identity provider initiated web SSO and comes with a working example application. If you sign up for a free trial with OneLogin, you can also test the example app or your own code with a live identity provider. http://support.onelogin.com/entries/165434-saml-toolkit-for-ruby-on-r... Feel free to contact us if you have any questions or are interested in partnering with OneLogin. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Table with dynamic content
On 19 May 2010 13:59, the batman li...@ruby-forum.com wrote: * you could (if you like it clunky) just use .each maintain your own counter and do your next row operations when it gets to a multiple of 3 I think that's what I was trying to do, though I didn't know how to get a new table row was I on the right track? I did try to hint that that was a poor option with all the Ruby goodness available to you! :-) Try: table % @photos.each_slice(3) do |photos_row| % tr % photos_row.each do |photo| % td%= link_to image_tag(photo.image.url(:thumb)), photo %/td % end % % # could do with some check here to pad out row with blank cells if any cell has less than three - to produce valid HTML (wouldn't need to worry about this with CSS placement :-) % tr/ % end % /table You could also pass the td drawing bit off to its own partial and pass it the photos-row collection; but that might be one step too far for you right now. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: define environment for rake db:seed
rake db:seed RAILS_ENV=production On May 19, 6:15 am, Rob Nichols li...@ruby-forum.com wrote: How do you define which version of the database is populated via the new default seed process? Running this: rake db:seed runs the code in seed.rb in the development environment and therefore loads the seed data into the development database. What is the syntax to use seed to populate the production database? -- Posted viahttp://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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: customized form_for in ApplicationHelper
Use a form builder. See the api doc. On May 19, 3:04 am, poseid mulder.patr...@gmail.com wrote: hello, I want to make a table within a form by making a new form_tag. The following code in ApplicationHelper fails: def tabular_form_for(name, object = nil, options = nil, proc) concat(table, proc.binding) form_for(name, object, (options||{}).merge(:builder = TabularFormBuilder), proc) concat(/table, proc.binding) end But using this tag in my view, I get errors with my :errors, :name fields of the form. Any ideas how to make this custom tag work? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Table with dynamic content
Not sure that you would want to do this but you can a = (1..20).to_a until a.empty? x = a.slice!(0,3) puts x.inspect end Gives [1, 2, 3] [4, 5, 6] [7, 8, 9] [10, 11, 12] [13, 14, 15] [16, 17, 18] [19, 20] so you could have table % until @photos.empty? -% % x = @photos.slice!(0,3) -% tr % x.each do |y| -% td%= y %/td % end -% /tr % end -% /table -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Re: Table with dynamic content
% @photos.in_groups_of(3, false) do |group| % tr % group.each do |photo| % td%= photo.filename_or_whatever %/td % end % /tr % end % or something relatively close to that -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: define environment for rake db:seed
tshim wrote: rake db:seed RAILS_ENV=production Thank you. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Unit Test newbie problem
RichardOnRails wrote: Thanks for your help. My faith the Unit Test *really* works is strengthening :-) Excellent! When you get a chance, try RSpec, see how much nicer it is, and watch yourself achieve enlightenment! Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: staying RESTful and triggering actions without saving a record.
frankjmat...@gmail.com wrote: where can i find the documentation for all of the action_controller_path functions? multiple submits on a form are no longer a viable solution because the only way to tell which one was hit was to know the name value of the submit button.. when its in different languages it gets ugly.. im just going to try to use a link_to solution but i cant figure out how _path wants its arguments. link_to 'release', station_path(@station, :state = :release), :method = :put generates a url that looks right but doesnt work. You should probably read the Rails routing guide. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] form_tag can't use get method
Hi there I try to use form_tag form_tag( post_path, :method = :put) to generate form action='/posts method=get But I got the following code form action='/posts?method=get method=post I am in rails 3.0.0 beta 3 Any one have the same situation? would you like to tell me how to fix it? Cheers, Danyi -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Plugin Architecture
Does anyone have any suggestions about building a plugin architecture for a Rails application? This would be different from the Rails plugin architecture; this would be plugins for my Rails application in particular (i.e. like Firefox extensions, or OpenOffice extensions) -- _ Joshua S. Martin -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: staying RESTful and triggering actions without saving a record.
yeah, i've read it half a dozen times - doesn't give me any insight on the argument list for the _path family of functions and apidock is less than helpful as well. searching through google led to some obscure blog that said i could do: link_to 'do something', station_path(@station, :station = { :attribute = :value }), :method = :put but why does this work and why aren't the _path functions clearly documented? maybe someone who knows could point me to where these functions are defined in the source tree (preferably in master)? On May 19, 10:09 am, Marnen Laibow-Koser li...@ruby-forum.com wrote: frankjmat...@gmail.com wrote: where can i find the documentation for all of the action_controller_path functions? multiple submits on a form are no longer a viable solution because the only way to tell which one was hit was to know the name value of the submit button.. when its in different languages it gets ugly.. im just going to try to use a link_to solution but i cant figure out how _path wants its arguments. link_to 'release', station_path(@station, :state = :release), :method = :put generates a url that looks right but doesnt work. You should probably read the Rails routing guide. Best, -- Marnen Laibow-Koserhttp://www.marnen.org mar...@marnen.org -- Posted viahttp://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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: ActionMailer using wrong layouts on prod box
had the same problem, any solutions ? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: When I do a migration, the changes are make in the test db
daphonz wrote: Have you tried using: rake db:migrate RAILS_ENV=production -c On May 18, 12:35�pm, Jorge alejandro Mendoza torres li...@ruby- I already tried the instruction and the migrations were made in the production database. But I have another problem, I had a record and I inserted others three records to my table, if I make a search and I want to find one of three new records, I can't find it, for instance: var = Table.find(:first, :conditions = [id_oficina = ?, clave[i].to_i]) In my table, all records exist. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: staying RESTful and triggering actions without saving a record.
frankjmat...@gmail.com wrote: yeah, i've read it half a dozen times Read *what*? Please quote when replying so it's clear what you're responding to. - doesn't give me any insight on the argument list for the _path family of functions and apidock is less than helpful as well. Are you talking about the routing guide? In any case, the arguments are whatever is defined in that particular route. Run rake routes or look at your routes file to see what that would be. searching through google led to some obscure blog that said i could do: link_to 'do something', station_path(@station, :station = { :attribute = :value }), :method = :put but why does this work and why aren't the _path functions clearly documented? Because they're generated from your routes, and so will be different for each Rails app. This is pretty clearly explained in the routing guide, as well as in the documentation for ActionController::Routing and ActionController::Resources . Perhaps you should read those again. maybe someone who knows could point me to where these functions are defined in the source tree (preferably in master)? Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: acts_as_list manual plugin install
Aerodame wrote: Due to some corporate firewall difficulties I decided to go to my home Mac and install the plugin in a rails project and then just copy the plugin from the vendors/plugin folder to my (inside) corporate project. Is there a special registration that needs to take place somehow for the plugin as rails doesn't seem to recognize the method yet. Often, yes. Copying plugins is rarely a good idea unless you remember to run install.rb . Probably better to use script/plugin install with a local path or a local repository URL. And if you have corporate firewall difficulties, get them resolved now (the http_proxy environment variable may be helpful on *nix). For effective Rails development, you're going to want working connections to rubygems.org and Github. How do you run the test function that is in the plugin directory? There's a Rake task -- test:plugins or something like that. BTW, I'm just following along in the Rails Up and Running book's examples to execute through this. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Self Creating edit page?
Expecting to get rendered: The same form page I've created at the :new action with the Invalid model notices from my model validations. What is getting rendered: A form that LOOKS the same, with my Invalid model notices but now does not POST to the :create action. The form has magically changed my hard coded input to post to the create action into a :put method to the :update action. I know it's kind of an obscure problem. Maybe later today I'll post a git repository with the code needed to recreate the problem. On May 19, 1:13 am, Sharagoz shara...@gmail.com wrote: On May 19, 2:36 am, brianp brian.o.pea...@gmail.com wrote: BUT the page gets rendered as an edit_dealer_id page. with a new hidden field telling the form to submit via put method. I dont really unserstand what you're saying. What are you expecting to get rendered, and what is actually getting rendered? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: staying RESTful and triggering actions without saving a record.
On May 19, 11:29 am, Marnen Laibow-Koser li...@ruby-forum.com wrote: frankjmat...@gmail.com wrote: yeah, i've read it half a dozen times Read *what*? Please quote when replying so it's clear what you're responding to. I have read the rails routing guide a dozen times. - doesn't give me any insight on the argument list for the _path family of functions and apidock is less than helpful as well. Are you talking about the routing guide? Yes. In any case, the arguments are whatever is defined in that particular route. Run rake routes or look at your routes file to see what that would be. That doesn't make any sense. My output of rake routes does not show a function name for put requests. What I've discovered (through trial and error) is that when using a _path function the arguments can either be in the form of _path(:id = @station) _path(@station) _path(@station, :attribute_not_on_the_model = :value) _path(@station, :station = { :this_attribute_is_on_model = :value}) where in the guide is that explained? if it's even in there it most certainly is not clear unless you already have a very good grasp of the subject. I don't believe that it's typical for someone reading the guides (mostly beginners I'll assume) to want to pass params in their links and send them off as put requests. searching through google led to some obscure blog that said i could do: link_to 'do something', station_path(@station, :station = { :attribute = :value }), :method = :put but why does this work and why aren't the _path functions clearly documented? Because they're generated from your routes, and so will be different for each Rails app. This is pretty clearly explained in the routing guide, as well as in the documentation for ActionController::Routing and ActionController::Resources . Perhaps you should read those again. ActionController::Resources is the only one of those that even hints at the proper form for the _path functions and that's only in the very first example which doesn't even say that it can be used for those functions - it only says this is what a so-and-so request looks like. http://rails.rubyonrails.org/classes/ActionController/Resources.html to quote the docs a little further down it says: Named Route Helper messagemessage_url(id), hash_for_message_url(id), message_path(id), hash_for_message_path(id) that would lead me to believe that the only argument available to those functions is id... maybe someone who knows could point me to where these functions are defined in the source tree (preferably in master)? This is all I'm really interested in now. Simply for curiosities sake... The rest I've figured out and is all moot. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: staying RESTful and triggering actions without saving a record.
frankjmat...@gmail.com wrote: [...] In any case, the arguments are whatever is defined in that particular route. �Run rake routes or look at your routes file to see what that would be. That doesn't make any sense. Whether it makes sense or not, it is the case. :) The arguments are the :parameters in the route. My output of rake routes does not show a function name for put requests. No, but if you're using map.resources, the paths for PUT requests are the same as for named GET requests. Using a link to a PUT request, though, is *extremely* smelly. Links should practically always be GET. [...] as well as in the documentation for ActionController::Routing and ActionController::Resources . �Perhaps you should read those again. ActionController::Resources is the only one of those that even hints at the proper form for the _path functions and that's only in the very first example which doesn't even say that it can be used for those functions - it only says this is what a so-and-so request looks like. http://rails.rubyonrails.org/classes/ActionController/Resources.html There's also the stuff about named routes in ActionController::Routing. to quote the docs a little further down it says: Named Route Helper messagemessage_url(id), hash_for_message_url(id), message_path(id), hash_for_message_path(id) that would lead me to believe that the only argument available to those functions is id... Again, it depends on how your routes are defined. maybe someone who knows could point me to where these functions are defined in the source tree (preferably in master)? This is all I'm really interested in now. Simply for curiosities sake... The rest I've figured out and is all moot. I suspect looking at the source for the resources function would be a good place to start. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: accepts nest attributes attr_accessible
Yeah the objective protecting the foreign keys are not letting the Users make the changes. Maybe an admin of the app could say a person or child has changed families (parents do split up). But we don't want some smart child using curl and changing his family to any family id he wants on his own. And thereby getting access to another families options/pages or capabilities. In my particular applications case as you've seen example code. I have dealers and users. Users belong to a dealer. Users would have foreign keys attr_protected. Becuase at no point is a user ever changing what dealer it belongs to. But if the keys can be mass assigned. Then isn't the app then vulnerable to someone creating a user that could belong to ANY dealership. Then gaining access to another dealerships admin panel ? But if the id can't be mass assigned then it cannot be created through the dealer via nested attributes. Which makes me think the only models that can be assigned via nested attributes are un-secure and vulnerable to mass-assignment attacks. attr_readonly does not look like it would solver the problem. As again on the initial create any use could assign any foreign key to themselves on the initial create. Maybe i'm wrong here and maybe this just isn't a concern at all somehow. But after reading the security issues on mass-assignment I don't understand how there not vulnerabilities. If a user can change a foreign key which is used for authorization purposes. Then there changing privileges for them self. Thanks for all the replies Sharagoz your really cleaning up my posts =) ie helping me understand rails better everyday! On May 19, 12:00 am, Sharagoz shara...@gmail.com wrote: Why does Child even have the family_id attribute? Can't you get the child's family through it's person (parent)? Unless the child can belong to a different family than the person, this is an unnecessary association. Anyway, that doesn't really answer the question. accepts_nested_atrributes_for and attr_protected on the foreign keys doesn't work together. My question is: Why are you putting attr_protected on the foreign_keys? To prevent users from being able to move a child to a different parent when editing its attributes? If so, I recommend you use attr_readonly instead. On May 19, 5:09 am, brianp brian.o.pea...@gmail.com wrote: Hey, Just going over some of the accepts of accepts_nested_attributes_for attr_accessible. I found with the form and models I've been working on it would be great if I could use accepts_nested_attribtues but I want to propose my case where I just can't make it work. And for secretory reasons wonder where it would ever work for that matter. So below. We have a household setup. We would have a Family object with an id. Now if we were to create one person for the family we could do it easily with: @family = Family.new @family.persons.new(params[person]) But what if we wanted to add a person and a child at the same time via nested parameters? We won't be able to. As the childs family_id field is protected we won't be able to mass assign with the nested parameters. I can't think of a time I would ever be creating a completely open object that wouldn't have a single protected parameter. So when do the nested_attributes come in handy besides when your model is un-secure? (This is just me learning there very well might be perfect places for this, I am just wondering where) class Person ActiveRecord::Base validates_presence_of :name, :family_id has_many :children belongs_to :family accepts_nested_attributes_for :children attr_accessible :name end class Child ActiveRecord::Base belongs_to :person belongs_to :family validates_presence_of :name, :family_id attr_accessible :name end class Family ActiveRecord::Base has_many :persons has_many :children (childs?) attr_protected :id end cheers, brianp -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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
Re: [Rails] Re: When I do a migration, the changes are make in the test db
On 19 May 2010 16:09, Jorge alejandro Mendoza torres li...@ruby-forum.com wrote: daphonz wrote: Have you tried using: rake db:migrate RAILS_ENV=production -c On May 18, 12:35�pm, Jorge alejandro Mendoza torres li...@ruby- I already tried the instruction and the migrations were made in the production database. But I have another problem, I had a record and I inserted others three records to my table, if I make a search and I want to find one of three new records, I can't find it, for instance: var = Table.find(:first, :conditions = [id_oficina = ?, clave[i].to_i]) In my table, all records exist. You would really have been be better to start a new thread for this. Now the subject does not relate to your problem. Have a look in the log file (development.log if you are in development mode), it will show the sql being used. Does it look right? How do you know it is not finding the record? 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Self Creating edit page?
On 19 May 2010 16:44, brianp brian.o.pea...@gmail.com wrote: Expecting to get rendered: The same form page I've created at the :new action with the Invalid model notices from my model validations. What is getting rendered: A form that LOOKS the same, with my Invalid model notices but now does not POST to the :create action. The form has magically changed my hard coded input to post to the create action into a :put method to the :update action. Have you checked the html of the page to see exactly what is being generated incorrectly? View, Page Source or similar in browser. I know it's kind of an obscure problem. Maybe later today I'll post a git repository with the code needed to recreate the problem. On May 19, 1:13 am, Sharagoz shara...@gmail.com wrote: On May 19, 2:36 am, brianp brian.o.pea...@gmail.com wrote: BUT the page gets rendered as an edit_dealer_id page. with a new hidden field telling the form to submit via put method. I dont really unserstand what you're saying. What are you expecting to get rendered, and what is actually getting rendered? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] I18N error
I have the following in my en.yml en: hello: Hello world activerecord: errors: models: et: not_enough: Not enough points for this transaction when I call I18n.t :not_enough in my custom validation method in model Et, I get a translation missing error. I have restarted the app, no luck. I can translate 'hello' just fine. 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Cannot have both select and radio_button together on the same form
Hello, I'm new to Ruby on Rails. I am creating a form for searching purpose: % form_for :src_cond, :url = {:action ='search'} do |p| % %= p.radio_button(bd, 1) % a %= p.radio_button(bd, 2) % b %= p.select :bd2, %w[1 2 3 4],{},{:index=nil} % %= p.submit Search % % end % When I click Search, the browser shows: We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly. When I check the log, it says: Status: 500 Internal Server Error expected Array (got Hash) for param `src_cond' I've put some puts statements in the controller, which indicates the controller is not called at all. If I have only radio_button or select in the form, the controller will be called as expected. I wonder how I may have both combo box and radio group at the same time. Many 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] how to restrict/control access to certain model attributes depending on role
Hi! Assume I have a model named Thread. Normal users should be able to change the attributes [title, body]. Admin users should be able to change [title, body, sticky, ...]. Now I wonder what's the corrent/best way to restrict/control access to certain model attributes depending on the current user's role etc. I currenty do it like this: Depending on the current user's role the controller creates an instance of UserPost or AdminPost. This gives me the ability of different templates, different callbacks etc. which is great and what I need. But the problem is rails thinks UserPost/ AdminPost is a STI (because UserPost User) and so looks for a column named 'type' (especially when using mongoid). But these are actually not STI but only helper models. How can I turn off STI, but still make rails use the posts table (and not user_posts/ admin_posts)? Solutions for rails 3 would be best :-) Thanks, Corin -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Self Creating edit page?
Yes I have that's how I know it's changing the form method to PUT to dealer/id/edit. It's also adding an id of: edit_dealer_id_{#number} where {#number} is an actual digit. On May 19, 9:38 am, Colin Law clan...@googlemail.com wrote: On 19 May 2010 16:44, brianp brian.o.pea...@gmail.com wrote: Expecting to get rendered: The same form page I've created at the :new action with the Invalid model notices from my model validations. What is getting rendered: A form that LOOKS the same, with my Invalid model notices but now does not POST to the :create action. The form has magically changed my hard coded input to post to the create action into a :put method to the :update action. Have you checked the html of the page to see exactly what is being generated incorrectly? View, Page Source or similar in browser. I know it's kind of an obscure problem. Maybe later today I'll post a git repository with the code needed to recreate the problem. On May 19, 1:13 am, Sharagoz shara...@gmail.com wrote: On May 19, 2:36 am, brianp brian.o.pea...@gmail.com wrote: BUT the page gets rendered as an edit_dealer_id page. with a new hidden field telling the form to submit via put method. I dont really unserstand what you're saying. What are you expecting to get rendered, and what is actually getting rendered? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: OneLogin releases SAML for Ruby
Thanks for the reply, So I guess there is no ruby implementation for SAML IdP service yet (or at least not open source one). - reynard On May 19, 5:43 am, ChristianP christian.b.peder...@gmail.com wrote: None of those will give you SAML identity provider functionality. They are both SAML service provider interfaces. - Christian On May 18, 6:32 pm, Reynard reynar...@gmail.com wrote: Hi there, thanks for releasing this toolkit. Does supports both service provider and identity provider initiated web SSO means you can run identity provider service with this toolkit? Also, does anyone have experience with saml2ruby gem?http://rubygems.org/gems/saml2ruby Looks like these are the only 2samllibraries I can find, and both has limited documentation. If I need to implement identity provider service which library is best to use? thanks! - reynard On May 3, 8:58 pm, Thomas Pedersen tho...@onelog.in wrote: We have just published a neat little toolkit for those of you who are interested inSAML-enabling your enterprise application.SAMLis a standards-based single sign-on protocol, which allows an identity provider to securely log users into an application without a password. Some of the advantages ofSAMLthat you avoid passwords altogether and can centralize access control at your identity provider. OneLogin'sSAMLkit supports both service provider and identity provider initiated web SSO and comes with a working example application. If you sign up for a free trial with OneLogin, you can also test the example app or your own code with a live identity provider. http://support.onelogin.com/entries/165434-saml-toolkit-for-ruby-on-r... Feel free to contact us if you have any questions or are interested in partnering with OneLogin. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Multiple Databases using an abstract class - help
Well like I said, I am trying to figure out how to use an abstract class to access a separate database. I understand why calling the object attribute is not working, what I am looking for is the proper way to interact with the separate database. If an abstract class is not the way, what is? If not find_by_sql then is connection.execute the right way? Looking for an actual solution. Thanks. On May 18, 1:33 pm, Frederick Cheung frederick.che...@gmail.com wrote: On May 18, 8:39 pm, Kim kim.gri...@gmail.com wrote: I am trying to figure out how to use an abstract class to access multiple databases. I can connect just fine using establish_connections in an abstract class, and I can query the database using find_by_sql on the abstract class. I am having problems with then using the data returned from the query. I am looking on any help on best practices and such. Why are you calling find_by_sql on an abstract class ? When you try and use the computer object (by calling name etc.) rails tries to work out what it should do with attributes (eg is it a string, a date, a number) and things of that order, and to do so it examines the schema for the table it thinks the objects come from. Fred -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Undefined method error when loading schema (Win 7)
I'm trying to run an existing project on a new installation of Rails on a Windows 7 machine. When I try to load the schema, I get: rake aborted! undefined method `full_name' for \377\376-:String I can't figure out what is causing the error. My best guess is some kind of gem conflict, but various reinstallations and copious experimentation have failed to get to the bottom of it. I'm running Rails 2.3.5, Ruby 1.8.7, and MySQL 5.0 and installed Ruby via the one-click installer. Loading the schema on another project was successful, so it must be something related to my specific project code, but I can't see what. If anyone can help, I'd be really grateful. A trace on schema:load gives: PS C:\Projects\otwarchive\otwarchive rake db:schema:load --trace (in C:/Projects/otwarchive/otwarchive) ** Invoke db:schema:load (first_time) ** Invoke environment (first_time) ** Execute environment rake aborted! undefined method `full_name' for \377\376-:String C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/ vendor_gem_source_index.rb: 50:in `refresh!' C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/ vendor_gem_source_index.rb: 45:in `each' C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/ vendor_gem_source_index.rb: 45:in `refresh!' C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/ vendor_gem_source_index.rb: 29:in `initialize' C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb: 21:in `ne w' C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb: 21:in `ad d_frozen_gem_path' C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:298:in `add_gem_lo ad_paths' C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:132:in `process' C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send' C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run' C:/Projects/otwarchive/otwarchive/config/environment.rb:40 C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_re quire' C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ dependenci es.rb:156:in `require' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ dependenci es.rb:521:in `new_constants_in' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/ dependenci es.rb:156:in `require' C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/misc.rake:4 C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_c hain' C:/Ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_c hain' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisit es' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisit es' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_c hain' C:/Ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_c hain' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exceptio n_handling' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exceptio n_handling' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run' C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31 C:/Ruby/bin/rake:19:in `load' C:/Ruby/bin/rake:19 -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] new controller - how do I access it via other controllers/views?
Guys, I have created a new controller Worker which has a method do_work(inputs), and another method show_work, which has a meaningful associated view (showing the results of the 'work'. So, I need to display the result of show_work in the view of another class called Consumer. So, I need to do a number of things: 1.) setup inputs (a hash) in the Consumer controller. 2.) have the consumer controller show method call Worker's method do_work(inputs) 3.) have the consumer show view show the results of show_work So, 2.) how do you call Worker.do_work(inputs)? Do I instantiate a Worker class and then call obj_name.do_work(inputs)? 3.) can I make use of the rendering going on in the show_work view in another classes show view? Thanks in advance! -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Cannot have both select and radio_button together on the same form
What are you trying to achieve with {:index=nil} on the select helper? %= p.select :bd2, %w[1 2 3 4] % should work On May 19, 5:28 pm, N.Li chunnim...@gmail.com wrote: Hello, I'm new to Ruby on Rails. I am creating a form for searching purpose: % form_for :src_cond, :url = {:action ='search'} do |p| % %= p.radio_button(bd, 1) % a %= p.radio_button(bd, 2) % b %= p.select :bd2, %w[1 2 3 4],{},{:index=nil} % %= p.submit Search % % end % When I click Search, the browser shows: We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly. When I check the log, it says: Status: 500 Internal Server Error expected Array (got Hash) for param `src_cond' I've put some puts statements in the controller, which indicates the controller is not called at all. If I have only radio_button or select in the form, the controller will be called as expected. I wonder how I may have both combo box and radio group at the same time. Many 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] partials and locals
I am calling a partial in another controller (benefits) like.. %= render :partial = benefits/b_index, :collection = @benefits, :locals = {:hide_list = true} % in the partial i just cant seem to access the local variable % if hide_list == true % throws unknown variable error and % if @hide_list == true % shows @hide_list as nil what am i doing wrong? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] new controller - how do I access it via other controllers/views?
On Wed, May 19, 2010 at 11:07 AM, chewmanfoo chewman...@gmail.com wrote: Guys, I have created a new controller Worker which has a method do_work(inputs), and another method show_work, which has a meaningful associated view (showing the results of the 'work'. So, I need to display the result of show_work in the view of another class called Consumer. So, I need to do a number of things: 1.) setup inputs (a hash) in the Consumer controller. 2.) have the consumer controller show method call Worker's method do_work(inputs) 3.) have the consumer show view show the results of show_work So, 2.) how do you call Worker.do_work(inputs)? Do I instantiate a Worker class and then call obj_name.do_work(inputs)? You can create a class method on the Worker's model. For example, def self.do_work( inputs ) ... end 3.) can I make use of the rendering going on in the show_work view in another classes show view? You can create a shared partial that can be rendered within the show template of the different controllers. Also, you can find alot of information on guides.rubyonrails.org Good luck, -Conrad Thanks in advance! -- 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 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Multiple Databases using an abstract class - help
On Wed, May 19, 2010 at 1:50 PM, Kim kim.gri...@gmail.com wrote: Well like I said, I am trying to figure out how to use an abstract class to access a separate database. I understand why calling the object attribute is not working, what I am looking for is the proper way to interact with the separate database. If an abstract class is not the way, what is? If not find_by_sql then is connection.execute the right way? Looking for an actual solution. I think you've got two things mixed up here. 1) the establish connection is what causes a model to connect to a specific database, effectively overriding the standard connection setup in ActiveRecord::Base. 2) If you want to have multiple models/tables connected to the same database, the way to do that is to have an abstract class from which they inherit the connection (much like normal models inherit the connection from ActiveRecord::Base). So if you only have a single model/table in the database, then just use 1 and not 2, I think. HTH -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: staying RESTful and triggering actions without saving a record.
In any case, the arguments are whatever is defined in that particular route. Run rake routes or look at your routes file to see what that would be. That doesn't make any sense. Whether it makes sense or not, it is the case. :) The arguments are the :parameters in the route. But I've never explicitly defined any parameters - and the notion of the arguments simply being a params-like hash had never occurred to me. I never saw it done. My output of rake routes does not show a function name for put requests. No, but if you're using map.resources, the paths for PUT requests are the same as for named GET requests. also a point that was not being connected in my head. Using a link to a PUT request, though, is *extremely* smelly. Links should practically always be GET. not that i would do something so ugly as set a links appearance to button - but does that make it any more acceptable? I've read plenty of religious war associated with this concept and believe that it's best evaluated on a need by need basis. In the workflow of my application a link that is styled a certain way most certainly conveys to the user that it does something important. With xss protection in rails and good testing it should be perfectly safe. as well as in the documentation for ActionController::Routing and ActionController::Resources . Perhaps you should read those again. ActionController::Resources is the only one of those that even hints at the proper form for the _path functions and that's only in the very first example which doesn't even say that it can be used for those functions - it only says this is what a so-and-so request looks like. http://rails.rubyonrails.org/classes/ActionController/Resources.html There's also the stuff about named routes in ActionController::Routing. to quote the docs a little further down it says: Named Route Helper message message_url(id), hash_for_message_url(id), message_path(id), hash_for_message_path(id) that would lead me to believe that the only argument available to those functions is id... Again, it depends on how your routes are defined. That sentence should be added to the docs somewhere. maybe someone who knows could point me to where these functions are defined in the source tree (preferably in master)? This is all I'm really interested in now. Simply for curiosities sake... The rest I've figured out and is all moot. I suspect looking at the source for the resources function would be a good place to start. Thank you kindly for the tip in that direction. Best, -- Marnen Laibow-Koserhttp://www.marnen.org mar...@marnen.org -- Posted viahttp://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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: new controller - how do I access it via other controllers/views?
regarding the class method you mentioned, then I can run the Worker.do_work(inputs) method by calling Worker.do_work(inputs)? On May 19, 1:20 pm, Conrad Taylor conra...@gmail.com wrote: On Wed, May 19, 2010 at 11:07 AM, chewmanfoo chewman...@gmail.com wrote: Guys, I have created a new controller Worker which has a method do_work(inputs), and another method show_work, which has a meaningful associated view (showing the results of the 'work'. So, I need to display the result of show_work in the view of another class called Consumer. So, I need to do a number of things: 1.) setup inputs (a hash) in the Consumer controller. 2.) have the consumer controller show method call Worker's method do_work(inputs) 3.) have the consumer show view show the results of show_work So, 2.) how do you call Worker.do_work(inputs)? Do I instantiate a Worker class and then call obj_name.do_work(inputs)? You can create a class method on the Worker's model. For example, def self.do_work( inputs ) ... end 3.) can I make use of the rendering going on in the show_work view in another classes show view? You can create a shared partial that can be rendered within the show template of the different controllers. Also, you can find alot of information on guides.rubyonrails.org Good luck, -Conrad Thanks in advance! -- 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 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2Bunsubscrib e...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: NoMethodError in User sessionsController#create - Authlogic
amit_pandya wrote: This things happens because of version conflict of authlogic, either upgrade or remove current one and install old one Adam Hill wrote: Hi, I had the same issue - I think it has something to do with the latest version of Authlogic possibly requiring Ruby 1.9???, whereas I'm running 1.8.6 on my dev machine and I see you're running 1.8.7. The commit 53834196c8f82cac6b105126e3d267246b7b2b67 from July 2, 2009 seems to be the issue: Use mb_chars when downcasing login to deal with international characters Specifying the previous gem version in my Rails environment seemed to do the trick: config.gem 'authlogic', :version = = 2.1.0 Let me know how it goes. On Aug 3, 4:34�am, Rzepak G. rails-mailing-l...@andreas-s.net -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: new controller - how do I access it via other controllers/views?
What chewmanfoo is talking about is moving code from the controller into the model. Basically, the consumer controller would call the worker model (if one exists), not the worker controller. When you're in a situation where you need to run two or more controller actions on the same request then it's a sign that your implementation isn't optimal. To call two controller actions you need two requests, which means a redirect after the first one, which means you need some place to store the state between the events. It shouldn't be necessary. On May 19, 8:26 pm, chewmanfoo chewman...@gmail.com wrote: regarding the class method you mentioned, then I can run the Worker.do_work(inputs) method by calling Worker.do_work(inputs)? On May 19, 1:20 pm, Conrad Taylor conra...@gmail.com wrote: On Wed, May 19, 2010 at 11:07 AM, chewmanfoo chewman...@gmail.com wrote: Guys, I have created a new controller Worker which has a method do_work(inputs), and another method show_work, which has a meaningful associated view (showing the results of the 'work'. So, I need to display the result of show_work in the view of another class called Consumer. So, I need to do a number of things: 1.) setup inputs (a hash) in the Consumer controller. 2.) have the consumer controller show method call Worker's method do_work(inputs) 3.) have the consumer show view show the results of show_work So, 2.) how do you call Worker.do_work(inputs)? Do I instantiate a Worker class and then call obj_name.do_work(inputs)? You can create a class method on the Worker's model. For example, def self.do_work( inputs ) ... end 3.) can I make use of the rendering going on in the show_work view in another classes show view? You can create a shared partial that can be rendered within the show template of the different controllers. Also, you can find alot of information on guides.rubyonrails.org Good luck, -Conrad Thanks in advance! -- 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 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2Bunsubscrib e...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Multiple Databases using an abstract class - help
To clarify: Some of the data for my rails app is stored in a non-rails DB table. I need to query this other database and then show the data in the rails app. I have a model (have tried with abstract class and without) Computers that is connected to the non-rails DB with establish_connection. Then in my controller I want to find all the computers in the non- rails DB and in my view I want to loop through the computers and show their name. I am trying to figure out the best way to query and show the data in the view. If I do row = Computer.connection.execute(query) I can then loop through the MySQL::Result list and access the data as an array - so row[0] gives me computer.name The problem with this is that I then need to know the position of the data in the result. I am wondering if there is a better way to query and then show the data. On May 19, 11:21 am, Rick DeNatale rick.denat...@gmail.com wrote: On Wed, May 19, 2010 at 1:50 PM, Kim kim.gri...@gmail.com wrote: Well like I said, I am trying to figure out how to use an abstract class to access a separate database. I understand why calling the object attribute is not working, what I am looking for is the proper way to interact with the separate database. If an abstract class is not the way, what is? If not find_by_sql then is connection.execute the right way? Looking for an actual solution. I think you've got two things mixed up here. 1) the establish connection is what causes a model to connect to a specific database, effectively overriding the standard connection setup in ActiveRecord::Base. 2) If you want to have multiple models/tables connected to the same database, the way to do that is to have an abstract class from which they inherit the connection (much like normal models inherit the connection from ActiveRecord::Base). So if you only have a single model/table in the database, then just use 1 and not 2, I think. HTH -- Rick DeNatale Blog:http://talklikeaduck.denhaven2.com/ Github:http://github.com/rubyredrick Twitter: @RickDeNatale WWR:http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn:http://www.linkedin.com/in/rickdenatale -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] render html partial from atom builder
So I have an action that results in atom: def index ... respond_to do |format| ... format.atom { render :layout = false} end end Then I have a builder template to render the atom, called index.atom.builder. Inside this builder template, I'd like to render one of my existing html partials, to put in the atom:content element, perfectly normal atom thing to do. xml.content :type = text/html do xml.text! render(:partial = my_thing) end The problem is that the template for my_thing is my_thing.html.erb. And since we're somehow in an xml 'context', the render call doesn't find it, it complains that no template could be found. If I change it to render(:partial = my_thing.html.erb), it works... sort of. Because it turns out THAT partial calls OTHER partials, and all of THOSE partial calls would also need to have .html.erb added to them. This is getting messy. Is there some better way to take care of this that involves sweet-talking Rails instead of fighting with 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Agile web Development with Rails section 9.3
Hello I am reading Agile Web Development with rails (third addition). And I need some help with it. I have reached chapter 9.3 (AJAX) when I press on the add to cart button I get an error message. a real ugly one. eventually, I downloaded the PDF version and copied the content of the files but it did not help. I have looked but could not find the problem. Please give me a hand. the files of this application are at: Download link: http://rapidshare.com/files/389266124/chapter-9.tar.gz http://localhost:3000/store I think that the error is written in javascript and this is it: - try { Element.update(cart, \n\ndiv class=\cart-title\Your Cart/div\ntable\n \n\n\n!-- START_HIGHLIGHT --\n\n tr id=\current_item\ \n\n!-- #END_HIGHLIGHT --\n\n\n\n\ntr\n td7times;/td\n tdPragmatic Project Automation/td\n td class=\item-price\$209.65/td\n/tr\n\n\n tr class=\total-line\\ntd colspan=\2\Total/td\ntd class=\total-cell\$209.65/td\n /tr\n\n/table\n\nform method=\post\ action=\/store/empty_cart\ class=\button-to\divinput type=\submit\ value=\Empty cart\ /input name=\authenticity_token\ type=\hidden\ value=\6ZdrTVjPgu0Lls4YyuTXbg1an5X/KKNZJKgDfruU6Qo=\ //div/form\n); $(current_item).visualEffect(highlight, {endcolor:#114411,startcolor:#88ff88}); } catch (e) { alert('RJS error:\n\n' + e.toString()); alert('Element.update(\cart\, \\\n\\ndiv class=\\\cart-title\\\Your Cart/div\\ntable\\n \\n\\n\\n!-- START_HIGHLIGHT --\\n\\n tr id=\\\current_item\\\ \\n\\n!-- #END_HIGHLIGHT --\\n\\n\\n\\n\\ntr\\n td7times;/td\\n tdPragmatic Project Automation/td\\n td class=\\\item-price\\\$209.65/td\\n/tr\\n\\n\\n tr class=\\\total-line\ntd colspan=\\\2\\\Total/td\\n td class=\\\total-cell\\\$209.65/td\\n /tr\\n\\n/table\\n\\nform method=\\\post\\\ action=\\\/store/empty_cart\\\ class=\\\button-to\\\divinput type=\\\submit\\\ value=\\\Empty cart\\\ /input name=\\\authenticity_token\\\ type=\\\hidden\\\ value=\\\6ZdrTVjPgu0Lls4YyuTXbg1an5X/KKNZJKgDfruU6Qo=\\\ //div/form\\n\);\n$(\current_item\).visualEffect(\highlight\, {\endcolor\:\#114411\,\startcolor\:\#88ff88\});'); throw e } - Thanks Angel -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: staying RESTful and triggering actions without saving a record.
frankjmat...@gmail.com wrote: In any case, the arguments are whatever is defined in that particular route. Run rake routes or look at your routes file to see what that would be. That doesn't make any sense. Whether it makes sense or not, it is the case. :) �The arguments are the :parameters in the route. But I've never explicitly defined any parameters - and the notion of the arguments simply being a params-like hash had never occurred to me. I never saw it done. I've definitely seen examples, but I couldn't find them when I went looking. My output of rake routes does not show a function name for put requests. No, but if you're using map.resources, the paths for PUT requests are the same as for named GET requests. also a point that was not being connected in my head. Using a link to a PUT request, though, is *extremely* smelly. �Links should practically always be GET. not that i would do something so ugly as set a links appearance to button - but does that make it any more acceptable? No. It has *nothing* to do with appearance. PUT is for updating an existing resource (generally through a form). I've read plenty of religious war associated with this concept and believe that it's best evaluated on a need by need basis. I think that the need for a PUT link does not exist, period. If your app is telling you that it wants a link, then it's telling you that it wants a GET, perhaps with a custom verb or extra parameter. Just never do PUT links (if you even *can* -- I'm not sure :method works on links; I hope it does not). In the workflow of my application a link that is styled a certain way most certainly conveys to the user that it does something important. With xss protection in rails and good testing it should be perfectly safe. There's also the stuff about named routes in ActionController::Routing. Again, it depends on how your routes are defined. That sentence should be added to the docs somewhere. It's pretty clear if you read the class doc. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Need Help
I have this application installed on my computer apache HTTP Server 2.2 Ruby 1.8.7 Gems Rails Mysql 5.1 in appache configuration file i made some change: From: Options Indexes FollowSymLinks To: Options Indexes FollowSymLinks ExecCGI unmark AddHandler cgi-script .cgi .rb Then i go to command prompt with ruby then type this: rails Testing C:\Testing\ruby script\generate controller mytest C:\Testing\ruby script\server So the server up and running, then i type this on the browser http://localhost:3000/ The welcome aboard page show up and when i type this on the browser: http://localhost:3000/mytest C:/Ruby/lib/ruby/1.8/timeout.rb:58: [BUG] Segmentation fault ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32] This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. and in the browser say We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly. Could anybody tell me where i did wrong, its just simple code? From what i read it suppose to say something like error can't find index in mytest because i havent define index in controller mytest For your information i already change database.yml in config folder development: adapter: mysql database: db username: root password: pass host: localhost test: adapter: mysql database: db username: root password: pass host: localhost production: adapter: mysql database: db username: root password: pass host: localhost Thank you for any replies, i really appreciate 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: staying RESTful and triggering actions without saving a record.
No. It has *nothing* to do with appearance. PUT is for updating an existing resource (generally through a form). and i am updating a resource... i'm not using #update_attributes, but in my controller I am saving. I think that the need for a PUT link does not exist, period. If your app is telling you that it wants a link, then it's telling you that it wants a GET, perhaps with a custom verb or extra parameter. Destroy links are still the default in rails - destroy and put are similar in that they both change data. Just never do PUT links (if you even *can* -- I'm not sure :method works on links; I hope it does not). It does -- and from what I've read - the implementation is sound. I have a confirmation dialog on the link further narrowing the scope of things that could go wrong. It's pretty clear if you read the class doc. That's a matter of opinion. Thanks for your help. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Need Help
by far the easiest way to use rails with apache is to use passenger: http://www.modrails.com/ On May 19, 3:02 pm, Payah Bleh li...@ruby-forum.com wrote: I have this application installed on my computer apache HTTP Server 2.2 Ruby 1.8.7 Gems Rails Mysql 5.1 in appache configuration file i made some change: From: Options Indexes FollowSymLinks To : Options Indexes FollowSymLinks ExecCGI unmark AddHandler cgi-script .cgi .rb Then i go to command prompt with ruby then type this: rails Testing C:\Testing\ruby script\generate controller mytest C:\Testing\ruby script\server So the server up and running, then i type this on the browser http://localhost:3000/ The welcome aboard page show up and when i type this on the browser:http://localhost:3000/mytest C:/Ruby/lib/ruby/1.8/timeout.rb:58: [BUG] Segmentation fault ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32] This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. and in the browser say We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly. Could anybody tell me where i did wrong, its just simple code? From what i read it suppose to say something like error can't find index in mytest because i havent define index in controller mytest For your information i already change database.yml in config folder development: adapter: mysql database: db username: root password: pass host: localhost test: adapter: mysql database: db username: root password: pass host: localhost production: adapter: mysql database: db username: root password: pass host: localhost Thank you for any replies, i really appreciate it -- Posted viahttp://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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Multiple Databases using an abstract class - help
Kim wrote: To clarify: Some of the data for my rails app is stored in a non-rails DB table. I need to query this other database and then show the data in the rails app. I can only tell you what I did when I needed to do this. I did NOT use find_by _sql, I actually set up ActiveRecord classes for each table in the 'non rails DB'. You can actually specify everything you need in ActiveRecord to over-ride rails conventions. I did have several of these tables in the same 'non-rails' DB, so they DID have a common abstract superclass with a connection. Here's the code, actually why copy and paste when I can link you to svn. An AR model for a particular table, as you can see you can even use AR associations (to other tables within the same db! Trying to make associations cross-db tends not to work): http://umlaut.rubyforge.org/svn/trunk/app/models/sfx_db/object.rb And the superclass that pretty much just establishes the connection (also note it uses an AR feature to make everything read-only, cause that's what I wanted in this case): http://umlaut.rubyforge.org/svn/trunk/app/models/sfx_db/sfx_db_base.rb Once I set that up, I can and do use ordinary AR stuff with those models, no need for find_by_sql and such. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Multiple Databases using an abstract class - help
Jonathan Rochkind wrote: An AR model for a particular table, as you can see you can even use AR associations (to other tables within the same db! Trying to make associations cross-db tends not to work): http://umlaut.rubyforge.org/svn/trunk/app/models/sfx_db/object.rb Heh, I also see reviewing old code I haven't looked at for a while, that naming one of my own classes Object probably wasn't a great idea, even if it is in a module namespace. Don't copy that part. :) -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Shibboleth
Hi, I also need to validate users via Shibboleth on a Ruby application using Nginx and Mongrel. I've searched but not found instructions on how to do this. Would someone please let me know if they have a resource for implementation of Shibboleth on a Ruby / Nginx / Mongrel setup? Thank you! Joe -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Postgres + Rail 3.0
Hi guys, I am really new to these things like ROR and Postgres. When I was installing ROR 3.0 it says Successfully installed rails 3.0.0 beta 1 gem installed Installing ri document for rails 3.0.0 beta File not Found: lib This is the one which I really dont understand and dont know what to do? Help me out guys plz... And I want to configure the database with postgresql and I want to know how it works... -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: How I can install Heroku Gem?
Yeah, thank you very much. The problem was the version of RubyGems. Uff, thanks, you (David and Marnen) are my salvation. Greetings. El 18 de mayo de 2010 20:35, Iván Hernández Cazorla ivanhcelrinconelme...@gmail.com escribió: Thanks David, then I try with this project that you show me. Don't worry and thanks for the help. Greetings 2010/5/18 David Zhu dzwestwindso...@gmail.com On May 18, 3:32 pm, David Zhu dzwestwindso...@gmail.com wrote: Iván Hernández Cazorla wrote: Hello Frederick, I am a newbie in the installation of gem for Ruby, but I try. To install a gem I do this: 1. Open *CMD*. I am not an expert on doing rails stuff on Windows, but as far as I know, git will work better on cygwin or this -http://code.google.com/p/ msysgit/ CMD is bad for git, I don't even know if it works. Maybe it does? But regardless, you should install the thing that I gave you above, and run your commands from that. (instead of CMD) 2. Write the path of my directory when I have the rails apps. In my case, C:\Users\Games\Documents\Ruby\rails_apps\ 3. Then, I go to the carpet *vendor/rails* of my app: C:\Users\Games\Documents\Ruby\rails_apps\rfb\vendor\rails\ Be in the root of your app, not vendor\rails. so be in C:\Users\Games\Documents\Ruby\rails_apps\rfb\ 4. Here, I write this command: *gem install heroku* 5. But, when I write says me: ERROR: While executing gem ... (Gem::GemNotFoundException) Could not find heroku ( 0) in any repository I think that these are the steps to follow, but I am not secure. Try-- gem install rubygems-update in your command line That should work. It sounds like your gem repositories are not set up correctly. What's the output of gem env ? I don't understand these, ¿output of gem env? Sorry, that I am spanish. type gem env (without the quotes) in the command line. thats what he meant In the directory *$path_of_rails_apps/rfb/vendor/rails/* I have the directory Heroku, and here is the files of the zip files *data *and * metadata*. That directory should not be in vendor/rails . Nothing should be in vendor/rails except what Rake puts in there. All right, althoug, where should be the gem directory? Thanks ;) Greetings Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- Posted viahttp://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 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com rubyonrails-talk%2bunsubscr...@googlegroups.comrubyonrails-talk%252bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. woops sorry for the repost, you guys beat me -- 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 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- *Mi Twitter http://twitter.com/distriker *Blog personal http://distriker.co.cc *Fundador del proyecto IMGBeta *Twitter oficial de IMGBeta http://twitter.com/imgbeta *Webmaster del proyecto http://hispaturismo.com *Webmaster de http://rincon-blogger.blogspot.com -- *Mi Twitter http://twitter.com/distriker *Blog personal http://distriker.co.cc *Fundador del proyecto IMGBeta *Twitter oficial de IMGBeta http://twitter.com/imgbeta *Webmaster del proyecto http://hispaturismo.com *Webmaster de http://rincon-blogger.blogspot.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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] list controller actions
Is there a way to list on a web page the current controller actions define din the controller? Would like to put up a link for each automatically. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Postgres + Rail 3.0
On Wed, May 19, 2010 at 1:26 PM, Siva Kilaru li...@ruby-forum.com wrote: Hi guys, I am really new to these things like ROR and Postgres. When I was installing ROR 3.0 it says Successfully installed rails 3.0.0 beta 1 gem installed Installing ri document for rails 3.0.0 beta File not Found: lib This is the one which I really dont understand and dont know what to do? Help me out guys plz... And I want to configure the database with postgresql and I want to know how it works... Siva, if you're new to Rails 3.0, I would recommend getting things working with Sqlite3. Then move to PostgreSQL at a later date. In short, focus on learning the basics of RoR. BTW, I tend to use Sqlite3 for development and PostgreSQL or MySQL for stagging and production. Good luck, -Conrad -- 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 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] list controller actions
On May 19, 2010, at 1:35 PM, Me wrote: Is there a way to list on a web page the current controller actions define din the controller? Would like to put up a link for each automatically. PagesController.instance_methods(false) = [destroy, contact, list, show, expire_all, edit, method_missing] You may need to edit down the list just a bit, as you can see. I implemented a few methods in this class (like method_missing) that should be actions that might not be appropriate in a list. Good luck. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] list controller actions
Cool forgot about the (false). Any way to get the respond_to formats also On Wed, May 19, 2010 at 15:55, steve ross cwdi...@gmail.com wrote: On May 19, 2010, at 1:35 PM, Me wrote: Is there a way to list on a web page the current controller actions define din the controller? Would like to put up a link for each automatically. PagesController.instance_methods(false) = [destroy, contact, list, show, expire_all, edit, method_missing] You may need to edit down the list just a bit, as you can see. I implemented a few methods in this class (like method_missing) that should be actions that might not be appropriate in a list. Good luck. -- 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 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Postgres + Rail 3.0
Conrad Taylor wrote: On Wed, May 19, 2010 at 1:26 PM, Siva Kilaru li...@ruby-forum.com Good luck, -Conrad Thanku Conard, I appreciate it. I want to know about the file not found thing while installing Rails 3.0 beta. Can you help me out in this as well?? Good Luck Siva -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Multiple Databases using an abstract class - help
Thanks Jonathan for the example. I had been using an AR model for my non-rails table. The piece I was missing was setting the table name! So for others this is what I did class Whatever AR self.establish_connection :whatever (non-rails DB defined in .yml) self.set_table 'name of non-rails table' end whatever_controller.rb def index @rows = Whatever.find(:all) (find_by_sql works too) end now you can do AR stuff with @rows - like loop on it and call row.name Hope that helps someone else! Thanks. On May 19, 1:18 pm, Jonathan Rochkind li...@ruby-forum.com wrote: Jonathan Rochkind wrote: An AR model for a particular table, as you can see you can even use AR associations (to other tables within the same db! Trying to make associations cross-db tends not to work): http://umlaut.rubyforge.org/svn/trunk/app/models/sfx_db/object.rb Heh, I also see reviewing old code I haven't looked at for a while, that naming one of my own classes Object probably wasn't a great idea, even if it is in a module namespace. Don't copy that part. :) -- Posted viahttp://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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] list controller actions
On May 19, 2010, at 2:01 PM, Chris Habgood wrote: Cool forgot about the (false). Any way to get the respond_to formats also On Wed, May 19, 2010 at 15:55, steve ross cwdi...@gmail.com wrote: On May 19, 2010, at 1:35 PM, Me wrote: Is there a way to list on a web page the current controller actions define din the controller? Would like to put up a link for each automatically. PagesController.instance_methods(false) = [destroy, contact, list, show, expire_all, edit, method_missing] You may need to edit down the list just a bit, as you can see. I implemented a few methods in this class (like method_missing) that should be actions that might not be appropriate in a list. Good luck. Not sure what the respond_to formats are. Are you referring to whether Rails renders a particular format like XML, etc.? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] list controller actions
ya we have you know action.format set up, I was trying to auto set up links for each type. On Wed, May 19, 2010 at 16:49, steve ross cwdi...@gmail.com wrote: On May 19, 2010, at 2:01 PM, Chris Habgood wrote: Cool forgot about the (false). Any way to get the respond_to formats also On Wed, May 19, 2010 at 15:55, steve ross cwdi...@gmail.com wrote: On May 19, 2010, at 1:35 PM, Me wrote: Is there a way to list on a web page the current controller actions define din the controller? Would like to put up a link for each automatically. PagesController.instance_methods(false) = [destroy, contact, list, show, expire_all, edit, method_missing] You may need to edit down the list just a bit, as you can see. I implemented a few methods in this class (like method_missing) that should be actions that might not be appropriate in a list. Good luck. Not sure what the respond_to formats are. Are you referring to whether Rails renders a particular format like XML, etc.? -- 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 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: accepts nest attributes attr_accessible
A yeah i guess that does make sense. Now what about...I think well trying to come up with my counter-piece I answered my own question so let me see if I have it correct: If the user was created in context of the dealer like you said. Then in the dealers control panel the user can update there profile. If the profole was updated by finding the user and updating directly then this could be a secuirty issue as they could change the dealer id at that point by sneaking in :dealer_id. BUT If the user updates the profile and it's processed via the dealer then this would not be an issue because it would still be in context. how would this look in the controller? @dealer.users.find(3).update_attributes(params[:update_user_form]) ? Thanks, brianp On May 19, 9:48 am, Sharagoz shara...@gmail.com wrote: This is not a problem if you are always creating users in context of dealers and validating that the one doing the creation is allowed to manage the data for the dealer in question. @dealer.users.create(params[:user]) This ensures that the users dealer_id is set to @dealer.id, even if somebody tries to be clever and add dealer_id to the post request. On May 19, 6:07 pm, brianp brian.o.pea...@gmail.com wrote: Yeah the objective protecting the foreign keys are not letting the Users make the changes. Maybe an admin of the app could say a person or child has changed families (parents do split up). But we don't want some smart child using curl and changing his family to any family id he wants on his own. And thereby getting access to another families options/pages or capabilities. In my particular applications case as you've seen example code. I have dealers and users. Users belong to a dealer. Users would have foreign keys attr_protected. Becuase at no point is a user ever changing what dealer it belongs to. But if the keys can be mass assigned. Then isn't the app then vulnerable to someone creating a user that could belong to ANY dealership. Then gaining access to another dealerships admin panel ? But if the id can't be mass assigned then it cannot be created through the dealer via nested attributes. Which makes me think the only models that can be assigned via nested attributes are un-secure and vulnerable to mass-assignment attacks. attr_readonly does not look like it would solver the problem. As again on the initial create any use could assign any foreign key to themselves on the initial create. Maybe i'm wrong here and maybe this just isn't a concern at all somehow. But after reading the security issues on mass-assignment I don't understand how there not vulnerabilities. If a user can change a foreign key which is used for authorization purposes. Then there changing privileges for them self. Thanks for all the replies Sharagoz your really cleaning up my posts =) ie helping me understand rails better everyday! On May 19, 12:00 am, Sharagoz shara...@gmail.com wrote: Why does Child even have the family_id attribute? Can't you get the child's family through it's person (parent)? Unless the child can belong to a different family than the person, this is an unnecessary association. Anyway, that doesn't really answer the question. accepts_nested_atrributes_for and attr_protected on the foreign keys doesn't work together. My question is: Why are you putting attr_protected on the foreign_keys? To prevent users from being able to move a child to a different parent when editing its attributes? If so, I recommend you use attr_readonly instead. On May 19, 5:09 am, brianp brian.o.pea...@gmail.com wrote: Hey, Just going over some of the accepts of accepts_nested_attributes_for attr_accessible. I found with the form and models I've been working on it would be great if I could use accepts_nested_attribtues but I want to propose my case where I just can't make it work. And for secretory reasons wonder where it would ever work for that matter. So below. We have a household setup. We would have a Family object with an id. Now if we were to create one person for the family we could do it easily with: @family = Family.new @family.persons.new(params[person]) But what if we wanted to add a person and a child at the same time via nested parameters? We won't be able to. As the childs family_id field is protected we won't be able to mass assign with the nested parameters. I can't think of a time I would ever be creating a completely open object that wouldn't have a single protected parameter. So when do the nested_attributes come in handy besides when your model is un-secure? (This is just me learning there very well might be perfect places for this, I am just wondering where) class Person ActiveRecord::Base validates_presence_of :name, :family_id has_many :children belongs_to :family
[Rails] Anyone interested in a Rails opportunity in New Orleans?
TEKsystems is working with a client to find a Ruby on Rails developer for a position here in New Orleans. They are looking for an entry level or mid level Ruby on Rails developer. The client develops applications for e-commerce websites. This position is full-time and the candidate must work on-site in New Orleans. Remote work is not an option. This is a great company to work for! They are one of the fastest growing companies in New Orleans and operate like a startup company even though they have been around for more than 10 years. They work in a laid back environment that promotes creativity and new ideas. They even have a bowling alley in the middle of their office! Pay is based on experience and they provide a benefits package. Please email me at sbenn...@teksystems.com if you are interested! -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Looking for Easy Rails hosting
I'd have to second Heroku. It would be hard to devise something simpler. On May 19, 3:56 am, Trausti Thor Johannsson t...@studlar.net wrote: dreamhost.com, they are quite cheap and give you a chance to grow up for very little money. Then you can grow into a vps at their site or move elsewhere. What they offer is pretty much unlimited bandwith and diskspace and they have a very nice cpanel. Store as many sites as you want. On Tue, May 18, 2010 at 5:24 PM, Joshua Partogi joshua.part...@gmail.com wrote: IMHO Heroku is pretty simple. Kind regards, Joshua On May 19, 1:22 am, Mohammed Alenazi vb4...@gmail.com wrote: Hi I have registered for some paid rails hosting system that uses cpanel to deploy the rails apps. I could not deploy my app/ I tried several times with no success. Does any one know a good hosting company that provide guidelines or tutorial on how to deploy that rails apps on their servers? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] array of objects
If you have an array of objects and you do array_of_objects.each do |o| o.method end Do the attributes of the object get passed to the method so you can access them? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] visual effect for the div
Hi In a partial, I display group_name , when clicked on groupname the div with id=abc should appear below my group. I want to make my div visible false initially at the time of loading my page and Once click on the groupname I the div should be visible below the groupname. I tried with follwing code. But I div is visible every time and only the visual_effect is applying to the first grouname only. Please help. Thanks. div class=profile_text_details float_left h5 class=page_heading %= link_to_function user.group_name, visual_effect(:grow,abc,:direction = center,:duration = 1) , { :controller = users ,:action = grouplist } % /h5 /div div id=abc tr td class=people_profile div class=clear_float_effect % @currentgroupfriends.each do |user| % h6 class=page_heading%= user.login %/h6 % end % /div/tr thank you -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] sql statement help
i need to find records which are starts with numeric values. So how can i write the sql query? nirosh -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Facebook, authlogic, and OAuth2
nice. I'll be looking forward to that. Will it play nice with other login options (the old oauth in particular, which is still needed for Twitter)? Cheers, Andrew On May 19, 12:10 am, giovanni potoma...@gmail.com wrote: I'm working on a new version of authlogic_oauth that will use oauth2... I think it's what you are searching for... It will be released at the end of the week, keep eyes onhttp://github.com/potomak On May 8, 3:52 am, Alex a...@liivid.com wrote: Rpx might be good for some people. It's a single sign-on service that you pay a nominal fee to use. Doesn't fit the bill for me. Thanks. On May 7, 1:41 am, swetha swetha.angul...@gmail.com wrote: Yes ,working with authlogic you can use authlogic_rpx gem to make your application login usingfacebookor anyothers. http://github.com/tardate/rails-authlogic-rpx-sample For rpxwww.rpx.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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] array of objects
Sent from my iPhone On May 19, 2010, at 8:04 PM, Me chabg...@gmail.com wrote: If you have an array of objects and you do array_of_objects.each do |o| o.method end Do the attributes of the object get passed to the method so you can access them? The object's attributes are available within the instance method. For example, class MyClass attr_accessor :foo, :bar def some_method # access the attributes @foo = 1 self.bar = test end end o.some_method I would recommend getting a copy of Programming Ruby. Good luck, -Conrad -- 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 rubyonrails-talk+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en . -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Activerecord association design advice
Hi, ok if you replace Concept with Vehicle (ala tank, car, truck, plane, etc), Entity with Model (Z30, 911 turbo, F16, etc), Dimension with SubjectiveDimension (quality, comfort, etc) and Fact with FactualDimension (price, model_year, max_speed, etc) would it make more sense? 1) Vehicles have many models, subjective_dimensions and factual_dimensions 2) Vehicles may share subjective_dimensions but not factual_dimensions or or models 3) A rating is established by allowing users to rate all subjective_dimensions of the vehicle that the model belongs to So, I could rate an F16 by rating dimensions such as comfort_level, sexiness, quality_of_landing and then rate a Porche 911 by rating dimensions such as comfort_level, sexiness and steering_response. Both of them (the F16 and Porche) will have a factual_dimension called price. These dimensions are defined over all objects inside a vehicle. The subjective_dimensions can be shared between different entities (such as sexiness). They can be shared because they are subjective and relative differences don't matter. With factual_dimensions, what is considered a vehicle is not the same as a cheap car, that's why they cannot be shared over vehicles. So, changing the model files: def User has_many :ratings has_many :subjective_dimensions, :through = :ratings has_many :models, :through = :ratings def Vehicle has_and_belongs_to_many :subjective_dimensions has_many :factual_dimensions, :dependent = :destroy has_many :models, :dependent = :destroy def Model belongs_to :vehicles has_many :ratings has_many :subjective_dimensions, :through = :ratings has_many :users, :through = :ratings def SubjectiveDimension has_and_belongs_to_many :vehicles has_many :ratings has_many :users, :through = :ratings has_many :models, :through = :ratings def FactualDimension belongs_to :vehicles def Rating belongs_to :user belongs_to :model belongs_to :subjective_dimension I hope that makes things a little bit clearer? There are a few other details which I would like to get feedback on as well, but I'll leave that for after the above is taken care of. On Thu, May 20, 2010 at 12:28 AM, Sharagoz shara...@gmail.com wrote: To me it looks like you are doing way too much abstraction here. With model names like Concept, Entity and Dimension it is going to be extremly hard for anybody else to wrap their heads around what exactly you are trying to design. At least I can't do it, and hence I cant really give any advice either. On May 19, 1:49 pm, Ali ali.akhtarz...@gmail.com wrote: Hi guys. So I have a few models: Concept, Entity, Dimension, Rating, User and Fact 1) Concepts can have many dimensions and many entities and many facts. 2) Concepts may share dimensions, but not entities or facts (so the Concept universities can share the Dimension quality but not the Fact num_students. 3) A rating is determined by allowing a user to rate each dimension defined over the concept the entity belongs to. I'm trying to design the relationships on paper before starting, and I thought I'd run it by you guys for suggestions, improvements, advice, etc (I'm quite new to rails and ruby). def Dimension has_and_belongs_to_many :concepts # for the ratings table has_many :ratings has_many :entities, :through = :ratings has_many :users, :through = :ratings def Fact def Entity # for the ratings table has_many :ratings has_many :dimensions, :through = :ratings has_many :users, :through = :ratings def Concept has_and_belongs_to_many :dimensions has_many :entities, :dependent = :destroy has_many :facts, :dependent = :destroy def User # for the ratings table has_many :ratings has_many :dimensions, :through = :ratings has_many :entities, :through = ratings def Rating # the ratings table also has a value field when a user rates an entity's dimension belongs_to :dimensions belongs_to :users belongs_to :entities Thanks in advance -- 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 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com . For more options, visit this group athttp:// groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk