Search Results

Search found 17016 results on 681 pages for 'ruby debug'.

Page 5/681 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • error when running mysql2psql

    - by Mateo Acebedo
    I am trying to migrate a mysql database to a psql database, and after installing, I write the running command and instead of generationg the mysql2psql.yml file, this is what is being printed on my git bash window. $ mysql2psql c:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': c annot load such file -- 2.0/mysql_api (LoadError) from c:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' from c:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql-2.8.1-x86-mingw32/lib/mys ql.rb:7:in `rescue in ' from c:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql-2.8.1-x86-mingw32/lib/mys ql.rb:2:in `' from c:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' from c:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' from c:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2psql-0.1.0/lib/mysql2psql /mysql_reader.rb:1:in `' from c:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' from c:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' from c:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2psql-0.1.0/lib/mysql2psql .rb:5:in `' from c:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' from c:/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' from c:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2psql-0.1.0/bin/mysql2psql :5:in `' from c:/Ruby200/bin/mysql2psql:23:in `load' from c:/Ruby200/bin/mysql2psql:23:in `' Any thoughts?

    Read the article

  • Installing MySQL-Ruby on Linux and Ruby 1.9.2

    - by Klam
    I am having an absurdly difficult time getting MySQL-Ruby to install on RedHat 4 using Ruby 1.9.2. I am behind a company proxy that prevents pretty much any package tool from connecting to external repositories so "gem install mysql" isn't going to cut it. I have tried installing the mysql-ruby gem locally but it fails with a mysterious: $gem install mysql-2.8.1.gem Building native extensions. This could take a while... ERROR: Error installing mysql-2.8.1.gem: ERROR: Failed to build gem native extension. /ns/local/apps/internal/SWS/MetricsPublisher/ruby/bin/ruby extconf.rb checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lmygcc... no checking for mysql_query() in -lmysqlclient... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. I have also tried building the module myself by following the included readme. The results: $ruby extconf.rb --with-mysql-include=/path_to_my_sql_headers/mysql/include/ --with-mysql-lib=/path_to_my_sql_lib/mysql/lib/ checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lmygcc... no checking for mysql_query() in -lmysqlclient... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Does anybody have any ideas? Quite frankly, I don't even care if MySQL-Ruby specifically works, I just want ANY means of connecting to a MySQL DB through a ruby call in ruby 1.9. Thanks.

    Read the article

  • Using SQL Developer to Debug your Anonymous PL/SQL Blocks

    - by JeffS
    Everyone knows that SQL Developer has a PL/SQL debugger – check! Everyone also knows that it’s only setup for debugging standalone PL/SQL objects like Functions, Procedures, and Packages, right? – NO! SQL Developer can also debug your Stored Java Procedures AND it can debug your standalone PLSQL blocks. These bits of PLSQL which do not live in the database are also known as ‘Anonymous Blocks.’ Anonymous PL/SQL blocks can be submitted to interactive tools such as SQL*Plus and Enterprise Manager, or embedded in an Oracle Precompiler or OCI program. At run time, the program sends these blocks to the Oracle database, where they are compiled and executed. Here’s an example of something you might want help debugging: Declare x number := 0; Begin Dbms_Output.Put(Sysdate || ' ' || Systimestamp); For Stuff In 1..100 Loop Dbms_Output.Put_Line('Stuff is equal to ' || Stuff || '.'); x := Stuff; End Loop; End; / With the power of remote debugging and unshared worksheets, we are going to be able to debug this ANON block! The trick – we need to create a dummy stored procedure and call it in our ANON block. Then we’re going to create an unshared worksheet and execute the script from there while the SQL Developer session is listening for remote debug connections. We step through the dummy procedure, and this takes OUT to our calling ANON block. Then we can use watches, breakpoints, and all that fancy debugger stuff! First things first, create this dummy procedure - create or replace procedure do_nothing is begin null; end; Then mouse-right-click on your Connection and select ‘Remote Debug.’ For an in-depth post on how to use the remote debugger, check out Barry’s excellent post on the subject. Open an unshared worksheet using Ctrl+Shift+N. This gives us a dedicated connection for our worksheet and any scripts or commands executed in it. Paste in your ANON block you want to debug. Add in a call to the dummy procedure above to the first line of your BEGIN block like so Begin do_nothing(); ... Then we need to setup the machine for remote debug for the session we have listening – basically we connect to SQL Developer. You can do that via a Environment Variable, or you can just add this line to your script - CALL DBMS_DEBUG_JDWP.CONNECT_TCP( 'localhost', '4000' ); Where ‘localhost’ is the machine where SQL Developer is running and ’4000′ is the port you started the debug listener on. Ok, with that all set, now just RUN the script. Once the PL/SQL call is made, the debugger will be invoked. You’ll end up in the DO_NOTHING() object. Debugging an ANON block from SQL Developer is possible! If you step out to the ANON block, we’ll end up in the script that’s used to call the procedure – which is the script you want to debug. The Anonymous Block is opened in a new SQL Dev page You can now step through the block, using watches and breakpoints as expected. I’m guessing your scripts are going to be a bit more complicated than mine, but this serves as a decent example to get you started. Here’s a screenshot of a watch and breakpoint defined in the anon block being debugged: Breakpoints, watches, and callstacks - oh my! For giggles, I created a breakpoint with a passcount of 90 for the FOR LOOP to see if it works. And of course it does You Might Also EnjoyUsing Pass Counts to Turbo Charge Your PL/SQL BreakpointsSQL Developer Tip: Viewing REFCURSOR OutputThe PL/SQL Debugger Strikes Back: Episode VDebugging PL/SQL with SQL Developer: Episode IVHow to find dependent objects in your PL/SQL Programs using SQL Developer

    Read the article

  • Ruby on Rails simple_navigation Gem

    - by Paul
    I'm using the simple_navigation gem with RoR 2.3.5 It all seems to work correctly, I followed the info in the RDoc (seen here http://rdoc.info/projects/mexpolk/simple_navigation) However, when I actually render out the simple_navigation menu on my main application.html.erb file it escapes all of the html in it (multiple escapes actually). I end up with junk like this which in a browser ends up with all kinds of disjointed text and ["\ things everywhere. <ul class="simple_navigation" depth="0" id="simple_navigation_default"> ["<li class=\"menu\" drop_down=\"true\" id=\"simple_navigation_default_menus_home\"><a href=\"/home\">Wellcome</a><ul depth=\"1\" id=\"simple_navigation_default_menus_home_menus\"> [\"<li class=\\\"menu\\\" drop_down=\\\"false\\\" id=\\\"simple_navigation_default_menus_home_menus_settings\\\"><a href=\\\"/home/settings\\\">Appliction Settings</a></li>\"] </ul> </li>"] What am I doing wrong? Is there a way to tell Ruby on rails to NOT escape html?

    Read the article

  • Ruby on Rails / Yellow Maps For Ruby Plugin woes...

    - by Zach
    Okay I've read through the plugin comments and the docs as well and I have yet to come up with an answer as to how to do this. Here's my problem I want to use the :info_window_tabs and the :icon option, but I don't know what format to pass my information in. According to the documentation the following code should be correct. Here's my code: @mapper.overlay_init(GMarker.new([map.lat, map.lng], :title => map.name, :info_window_tabs => [ {:tab => "HTML", :content => @marker_html}, {:tab => "Attachments", :content => "stuff"}], :icon => { :image => "../images/icon.png" })) The readme and documentation can be viewed here. And the relevant ruby file that I am trying to interact with, including the author's comments, can be viewed here. I have tried the #rubyonrails channel in IRC as well as emailing the author directly and reporting an issue at GitHub. It really is just a question of syntax. Thanks!

    Read the article

  • SOAP client generator for ruby/ruby on rails

    - by Sohan
    I have been looking for a fully functional WSDL client generator for ruby. I tried the one called wsdl2ruby and it didn't work. I think it has problems with detecting complex types correctly. Can someone point me to the right library if there is one? I am specifically looking to generate a full functional client for SOAP API provided by jira. I looked into jira4r but it seems to be dead now and not up to date. Any help is much appreciated. Thank you.

    Read the article

  • Ruby Iconv works with irb and ruby debugger but not in a unit test

    - by Mark B
    I'm running Ruby 1.8.7 with Rails 2.3.5 on Ubuntu 10.04 64-bit. I've written a method that should take a string like this, "École À la Découverte" and output a file-system name like this "ecole_a_la_decouverte": (Iconv.new('US-ASCII//TRANSLIT', 'utf-8').iconv "École À la Découverte").gsub(/[^\w\s-\—]/,'').gsub(/[^\w]|[_]/,' ').split.join('_').downcase When I test this line in my code, the test always fails saying that "cole_la_dcouverte" is unequal to "ecole_a_la_decouverte". The odd thing is that if I insert a debugger line and use the debugger console the test passes. As well, running this line manually in irb seems to work. Does anyone know what's going on and why this test is failing? My only thought is that including the debugger or irb somehow adds more support for UTF-8 but I'm at a loss to figure out where to go next. Thanks in advance!

    Read the article

  • Ruby (Rack) application could not be started - Passenger (3.0.9) error for rails 3.1.0 app on ubuntu and nginx (1.0.6) after deploying

    - by user938363
    Here is the error saying bcrypt was not loaded. The rails app is not using the Devise for authentication and gem bcrypt is not in Gemfile. Sometime, the webserver throws out the error saying spawn server can not start. gem list shows that both bcrypt-ruby 3.0.1 and 3.0.0 were installed. Ruby (Rack) application could not be started A source file that the application requires, is missing. * It is possible that you didn't upload your application files correctly. Please check whether all your application files are uploaded. * A required library may not installed. Please install all libraries that this application requires. Further information about the error may have been written to the application's log file. Please check it in order to analyse the problem. Error message: no such file to load -- bcrypt Exception class: LoadError Application root: /vol/www/emclab/current Backtrace: # File Line Location 0 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb 240 in `require' 1 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb 240 in `block in require' 2 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb 225 in `load_dependency' 3 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb 240 in `require' 4 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/activemodel-3.1.0/lib/active_model/secure_password.rb 1 in `' 5 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/base.rb 2160 in `block in ' 6 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/base.rb 2140 in `class_eval' 7 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/base.rb 2140 in `' 8 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/base.rb 31 in `' 9 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/session_store.rb 77 in `' 10 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/session_store.rb 51 in `' 11 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/session_store.rb 1 in `' 12 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/application/configuration.rb 123 in `session_store' 13 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/application.rb 168 in `block in default_middleware_stack' 14 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/application.rb 142 in `tap' 15 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/application.rb 142 in `default_middleware_stack' 16 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/engine.rb 445 in `app' 17 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/application/finisher.rb 37 in `block in ' 18 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/initializable.rb 25 in `instance_exec' 19 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/initializable.rb 25 in `run' 20 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/initializable.rb 50 in `block in run_initializers' 21 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/initializable.rb 49 in `each' 22 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/initializable.rb 49 in `run_initializers' 23 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/application.rb 92 in `initialize!' 24 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/railties-3.1.0/lib/rails/railtie/configurable.rb 30 in `method_missing' 25 /vol/www/emclab/releases/20111115184804/config/environment.rb 5 in `' 26 config.ru 3 in `require' 27 config.ru 3 in `block in ' 28 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/rack-1.3.2/lib/rack/builder.rb 51 in `instance_eval' 29 /vol/www/emclab/shared/bundle/ruby/1.9.1/gems/rack-1.3.2/lib/rack/builder.rb 51 in `initialize' 30 config.ru 1 in `new' 31 config.ru 1 in `' 32 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb 222 in `eval' 33 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb 222 in `load_rack_app' 34 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb 156 in `block in initialize_server' 35 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/utils.rb 572 in `report_app_init_status' 36 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb 153 in `initialize_server' 37 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb 204 in `start_synchronously' 38 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb 180 in `start' 39 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb 128 in `start' 40 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 253 in `block (2 levels) in spawn_rack_application' 41 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb 132 in `lookup_or_add' 42 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 246 in `block in spawn_rack_application' 43 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb 82 in `block in synchronize' 44 prelude> 10:in `synchronize' 45 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb 79 in `synchronize' 46 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 244 in `spawn_rack_application' 47 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 137 in `spawn_application' 48 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 275 in `handle_spawn_application' 49 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb 357 in `server_main_loop' 50 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb 206 in `start_synchronously' 51 /home/dtt/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/helper-scripts/passenger-spawn-server 99 in `' cap deploy:check returns: You appear to have all necessary dependencies installed Any thoughts about the problem? thanks!

    Read the article

  • Python and Ruby in Tuxedo

    - by Maurice Gamanho
    With the release of SALT 11gR1, you can now develop Python/Ruby services/applications on Oracle Tuxedo platform. Python functions or Ruby classes can be invoked as Tuxedo services by other Tuxedo services or clients and, in addition, Python/Ruby applications can invoke existing Tuxedo services. SALT 11gR1 combines the proven scalability, reliability and performance of the Tuxedo runtime infrastructure with the agility provided by these dynamic scripting languages, providing a highly available and almost linearly scalable platform for Python and Ruby application development. Another benefit of developing Python and Ruby applications with Tuxedo is that services are SOA enabled from inception by virtue of Tuxedo's comprehensive integration options with J2EE app servers, mainframe applications, Web services, etc. Other interesting features are dynamic re-loading of scripts, where script changes are picked up automatically or when the administrator decides, and server-side typing, where Python functions and Ruby classes are given interfaces by way of the Tuxedo Metadata Repository. More information can be found on the Oracle SALT 11gR1 documentation page. See also SCA Python and Ruby Programming and Python and Ruby Data Type Mapping.

    Read the article

  • Android -> Ruby Server Interface -> Mongodb

    - by MRabRabbit
    I've been wrecking my brain about this for a few days. I'll run my scenario by you and hopefully you can help me. In my head this is how it goes: I have an Android App. I want my Android App to make (function) calls to a MongoDB database via a Ruby Interface on the Server. e.g. Android app sends a HTTP GET ? with the function name, let's say getFriends for this user Ruby Interface receives this request from the app, grabs a thread from a thread pool and calls the appropriate function call implemented in Ruby, to the Mongodb. Ruby Interface gets results from Mongodb and sends a HTML POST to the Android app. So that's how I think it works. I know about the ruby driver for mongo db, and interacting with the mongodb from ruby but, how do I make a ruby back end listen for incoming messages and should these messages be done through sockets or a http interface ala Net::http in ruby?

    Read the article

  • Ruby on Rails free books

    - by Madhan ayyasamy
    The following links has ruby on rails tutorials, you can download directly from there website, its fully free of cost..:)Beginning Ruby: From Novice to Professional Building Dynamic Web 2.0 Websites with Ruby on RailsRuby on Rails For DummiesAgile Web Development with RailsThe Ruby Way: Solutions and Techniques in Ruby ProgrammingBeginning Ruby on RailsRails RecipesRails CookbookAjax on RailsThe Art of Rails Programmer to Programmer

    Read the article

  • How can I move from Java and ColdFusion to Ruby on Rails?

    - by Ciaran Archer
    Currently I work with ColdFusion 9+ and some Java in a Windows environment. Prior to ColdFusion, my background was in Java and JSP. I'm considering a move towards Ruby on Rails, as I think it would be a real challenge, keep things fresh, and provide more job opportunities. In order to get into it, I started to build my personal website in Rails 3.0. But what else can I do to make this transition from what I know now to Ruby and Rails? Are there specific or idiomatic aspects of Ruby or Rails I should keep in mind when switching over from a ColdFusion and Java mindset?

    Read the article

  • How to test Rails 3 Engines with Cucumber & Rspec?

    - by cowboycoded
    I apologize if this question is slightly subjective... I am trying to figure out the best way to test Rails 3 Engines with Cucumber & Rspec. In order to test the engine a rails 3 app is necessary. Here is what I am currently doing: Add a rails test app to the root of the gem (myengine) by running: rails new /myengine/rails_app Add Cucumber to /myengine/rails_app/features as you would in a normal Rails app Require the Rails Engine Gem (using :path=>"/myengine") in /myengine/rails_app/Gemfile Add spec to the root directory of the gem: /myengine/spec Include the fixtures in /myengine/spec/fixtures and I add the following to my cuc env.rb: env.rb: Fixtures.reset_cache fixtures_folder = File.join(Rails.root, 'spec', 'fixtures') fixtures = Dir[File.join(fixtures_folder, '*.yml')].map {|f| File.basename(f, '.yml') } Fixtures.create_fixtures(fixtures_folder, fixtures) Do you see any problems with setting it up like this? The tests run fine, but I am a bit hesitant to put the features inside the test rails app. I originally tried putting the features in the root of the gem and I created the test rails app inside features/support, but for some reason my engine would not initialize when I ran the tests, even though I could see the app loading everything else when cuc ran. If anyone is working with Rails Engines and is using cuc and rspec for testing, I would be interested to hear your setup.

    Read the article

  • Error handling in Rails Controller for adding embedded Mongoid documents to Model

    - by Dragonfly
    I have a Item model that has embedded documents. Currently, the following comments_controller code will add a comment to the item successfully. However, if pushing the comment document onto the comments array on item fails, I will not know this. #this does work, but i do not know if the push fails def create comment = Comment.new(:text => params[:text]) @item.comments << comment render :text => comment end I would like to have something like this, but @item.comments << comment does not return true or false: #this does not work def create comment = Comment.new(:text => params[:text]) if @item.comments << comment render :text => comment else render :text => 'oh no' end end Nor does it throw an exception when the document push fails: #this does not work def create begin comment = Comment.new(:text => params[:text]) @item.comments << comment render :text => comment rescue Exception => e render :text => 'oh no' end end Thanks!

    Read the article

  • Is it possible to use best_in_place with typeahead from twitter bootstrap?

    - by Dave H
    Basically, I am using best_in_place in my rails webapp to let users edit their profile info in place. The thing is, I would like users to be presented with a typeahead form for certain entries.. Here's what I'm working with: <p>College/University: <input type="text" class="span3" style="margin: 0 auto;" data-provide="typeahead" data-items="8" data-source='["University of Pennsylvania","Harvard","Yale","Princeton","Cornell","Brown","Columbia","Dartmouth"]'></p> This gives me a working form box with typeahead. However, I want to be able to wrap this in best_in_place with something like <%= best_in_place @student, :education %> so that users only see the typeahead form when they click on the text, and upon clicking away from the box or hitting enter the selection is stored in the database. Is there a reasonably easy way to do this?

    Read the article

  • Find which alias method is called in rails model

    - by Kashif Umair Liaqat
    I am new to rails development. I have created some aliases to a method and I want to know that which alias is called. I have this code. alias_method :net_stock_quantity_equals :net_stock_quantity alias_method :net_stock_quantity_gte :net_stock_quantity alias_method :net_stock_quantity_lte :net_stock_quantity alias_method :net_stock_quantity_gt :net_stock_quantity alias_method :net_stock_quantity_lt :net_stock_quantity def net_stock_quantity #some code here end I want to know that user has called which alias. Like if user calls net_stock_quantity_equals then I should know that the user has called net_stock_quantity_equals not net_stock_quantity. Any help would be appreciated.

    Read the article

  • RoR | how to get content_tags to nest?

    - by Digital Cake
    As you can see I have a helper with a method that I'm trying to render out to the view. The nested content_tags do not render what is my disconnect about this tag? def draw_calendar(selected_month, month, current_date) content_tag(:table) do content_tag(:thead) do content_tag(:tr) do I18n.t(:"date.abbr_day_names").map{ |day| content_tag(:th, day, :escape => false) } end #content_tag :tr end #content_tag :thead content_tag(:tbody) do month.collect do |week| content_tag(:tr, :class => "week") do week.collect do |date| content_tag(:td, :class => "day") do content_tag(:div, date.day, :class => (Date.today == current_date ? "today" : nil)) end #content_tag :td end #week.collect end #content_tag :tr end #month.collect end #content_tag :tbody end #content_tag :table end #draw_calendar

    Read the article

  • Puppet and Vim fighting over Ruby version

    - by devians
    I have installed puppet from the .dmg from puppetlabs. If I remove ruby 1.9.3, puppet works, but other things like my vim install (dependant plugins) do not. According to http://docs.puppetlabs.com/guides/platforms.html#ruby-versions 1.9.3 is supported. So whats going wrong with puppet? % uname -a Darwin Kusanagi.local 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64 % which ruby /usr/local/bin/ruby % ruby --version ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin11.4.2] % /usr/bin/ruby --version ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0] % brew info ruby 1 ? ruby: stable 1.9.3-p327, HEAD http://www.ruby-lang.org/en/ Depends on: pkg-config, readline, gdbm, libyaml /usr/local/Cellar/ruby/1.9.3-p327 (796 files, 17M) * https://github.com/mxcl/homebrew/commits/master/Library/Formula/ruby.rb ==> Options --with-tcltk Install with Tcl/Tk support --with-suffix Suffix commands with "19" --universal Build a universal binary --with-doc Install documentation ==> Caveats NOTE: By default, gem installed binaries will be placed into: /usr/local/Cellar/ruby/1.9.3-p327/bin You may want to add this to your PATH. % puppet /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- puppet/util/command_line (LoadError) from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /usr/bin/puppet:3:in `<main>'

    Read the article

  • Using amCharts in Ruby on Rails

    - by Dexter
    I have followed this tutorial in order to use amChart and it worked with no problems , now I am trying to generate a chart with amCharts to show each user and the sign in count but i cant make it work because it not getting the data correctly, what i am missing here ? how can i show user email and sign_in_count ? Users_controller.rb class UsersController < ApplicationController load_and_authorize_resource def index @users = User.all respond_to do |format| format.html # index.html.erb format.json { render :json => @users } end end def show @user = User.find(params[:id]) end def new @user = User.new end def create @user = User.new(params[:user]) if @user.save flash[:notice] = 'A new user created successfully.' redirect_to users_path else flash[:error] = 'An error occurred please try again!' redirect_to users_path end end def edit @user = User.find(params[:id]) end def update @user = User.find(params[:id]) if @user.update_attributes(params[:user]) flash[:notice] = 'Profile updated' redirect_to users_path else render 'edit' end end def destroy @user = User.find(params[:id]) if current_user == (@user) flash[:error] = "Admin suicide warning: Can't delete yourself." else @user.destroy flash[:notice] = 'User deleted' redirect_to users_path end end def checkname if User.where('user_name = ?', params[:user]).count == 0 render :nothing => true, :status => 200 else render :nothing => true, :status => 409 end return end end Users_helper.rb module UsersHelper def convert_to_amcharts_json(data_array) data_array.to_json.gsub(/\"text\"/, "text").html_safe end end index.html.erb <div id="chartdiv" style="width: 100%; height: 400px;"></div> <script type="text/javascript"> var chart; var chartData = <%= convert_to_amcharts_json(@users) %>; AmCharts.ready(function () { // SERIAL CHART chart = new AmCharts.AmSerialChart(); chart.dataProvider = chartData; chart.categoryField = "email"; // the following two lines makes chart 3D chart.depth3D = 20; chart.angle = 30; // AXES // category var categoryAxis = chart.categoryAxis; categoryAxis.labelRotation = 90; categoryAxis.dashLength = 5; categoryAxis.gridPosition = "start"; // value var valueAxis = new AmCharts.ValueAxis(); valueAxis.title = "Most Active users"; valueAxis.dashLength = 5; chart.addValueAxis(valueAxis); // GRAPH var graph = new AmCharts.AmGraph(); graph.valueField = "sign_in_count"; graph.colorField = "color"; graph.balloonText = "<span style='font-size:14px'>[[category]]: <b>[[value]]</b></span>"; graph.type = "column"; graph.lineAlpha = 0; graph.fillAlphas = 1; chart.addGraph(graph); // CURSOR var chartCursor = new AmCharts.ChartCursor(); chartCursor.cursorAlpha = 0; chartCursor.zoomable = false; chartCursor.categoryBalloonEnabled = false; chart.addChartCursor(chartCursor); // WRITE chart.write("chartdiv"); }); </script>

    Read the article

  • Ruby on Rails equivalent for Maven Archetypes

    - by Drew
    Maven Archetypes are handy ways to get a project up and going in no time flat. Rails is kinda like an archetype in and of itself. However, I'm curious to know if there are any Rails equivalents for Maven Archetypes. For example, I want to create an Archetype with full authentication already built in via Authlogic. With Maven Archetypes I would need to build a project with it already ready to go, create my archetype and start working back parameterizing things that should be parameterized. Then anyone can make a Rails project with Authlogic set up by filling out a few questions during the archetype generate command and boom! Fully functional Rails app with Authlogic built in. Is there a Rails Equivalent? Are Generators expected to do this? Is this just not Rails-y?

    Read the article

  • How to reflect in the database a new belongs_to and has_many relationship in Ruby on Rails

    - by Ken I.
    I am new to rails (usually a python guy) and have just been trying to build a simple task manager application for fun. I am using Devise for authentication and have a single Task object I am trying to relate to a user. I have added the following to the Task model: class Task < ActiveRecord::Base belongs_to :user end and I have added the following in my User model for Devise: class User < ActiveRecord::Base has_many :dreams <<normal Devise stuff>> end Whenever I added this information I then ran: rake db:migrate. It then gave me an error that the database field did not exist for user_id when I tried to do anything with it. I am sure it is something rather simple that I am missing. Thanks for the help.

    Read the article

  • Default values for model fields in a Ruby on Rails form

    - by Callum Rogers
    I have a Model which has fields username, data, tags, date, votes. I have form using form_for that creates a new item and puts it into the database. However, as you can guess I want the votes field to equal 0 and the date field to equal the current date when it is placed into the database. How and where would I set/apply these values to the item? I can get it to work with hidden fields in the form but this comes with obvious issues (someone could set the votes field to a massive number.

    Read the article

  • Adding lengths of strings together in Ruby

    - by ppreyer
    I'm trying to write a program that takes the length of my first, middle, and last names individually and then adds the total amount of letters up in the end. My answer keeps on being 666 instead of 18. Here is the code I have written: puts 'What is your first name?' firstName = gets.chomp realFirstName = firstName.length.to_i puts 'What is your middle name?' middleName = gets.chomp realMiddleName = middleName.length.to_i puts 'What is your last name?' lastName = gets.chomp realLastName = lastName.length.to_i puts 'Did you know there are ' + realFirstName.to_s + realMiddleName.to_s + realLastName.to_s + ' letters in your name?' Just wondering where I went wrong.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >