Re: [Rails] Re: will_change!
On 29 June 2012 03:03, kengsreng tang li...@ruby-forum.com wrote: For example: i have model Person Class Person id: 1 name: test end this code: Person.name_will_change! why we need to put that above line of code? I think these probably cover it. http://railscasts.com/episodes/109-tracking-attribute-changes/ http://archives.ryandaigle.com/articles/2008/3/31/what-s-new-in-edge-rails-dirty-object Colin -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
[Rails] retry problem
hi I am trying to update the following method as the retry we have hard coded to ensure the sql transaction retires three times does not work. When we get a failure it rolls back but does not retry. Is there another I can add a retry or correct the following code Gurdipe def export_data( table_nickname, output_data_file, column_headers ) component,table_nickname = get_component(table_nickname) data_warehouse_class = component.class data_warehouse_instance = data_warehouse_class.instance # Get table name teradata_table_name = data_warehouse_instance.send(table_nickname).to_s start_time = Time.now() # Create column list, with various casting and reformatting column_list = [] column_headers.each do |column_header| format = if column_header.type == 'DA' format = (format '/MM/DD') end column_def = CAST( COALESCE( TRIM( #{column_header.name} #{format} ) , '') as VARCHAR(#{column_header.max_length+10}) ) # Some data types need extra space so add 10 chars column_list.push(column_def) end * tries = 3 # try three times and then give up* begin # Create fastexport definition fed = END_FED .logtable DXWI_PROD_CRORDER_PLAY_PEN.promo_fexp_#{Time.now.strftime(%Y%m%d%H%M%S)}_log; .logon tdpm/#{DATA_WAREHOUSE_CONFIG['username']},#{DATA_WAREHOUSE_CONFIG['password']}; .begin export sessions 10; .export outfile #{output_data_file} format fastload mode record; /* FETCH DATA */ SELECT #{column_list.join( ,\n)} FROM #{teradata_table_name} ; /* END */ .end export; /* LOGOFF */ .logoff; /* DONE */ END_FED # Write definition to a temporary file, because calling it from a ruby pipe can cause blocks # on tables with lots of columns (denorm_brag_report) fed_file = #{GENERAL_SYSTEM_SETTINGS['fastexport_temp_dir']}/#{teradata_table_name.downcase}_data.fed File.open(fed_file, 'w') {|f| f.write(fed) } RAILS_DEFAULT_LOGGER.info(FLA_FILE_PATH: #{output_data_file}) RAILS_DEFAULT_LOGGER.info(TERADATA_TABLE: #{teradata_table_name}) RAILS_DEFAULT_LOGGER.info(Fastexport Definition File:\n #{fed_file}\n) RAILS_DEFAULT_LOGGER.info(Fastexport Definition:\n #{fed}\n) # Use fexp (fastexport) as system command RAILS_DEFAULT_LOGGER.info(Executing fastexport) output = nil open_return = IO.popen(fexp #{fed_file}, w+) do |pipe| pipe.close_write() output = pipe.read() end rescue *tries -= 1* sleep(1) # since we sometime get a time stamp problem, wait one second and then retry retry if tries 0 raise # re-raise the exception if it hasn't been retried end # Check results result = $? if result == 0 RAILS_DEFAULT_LOGGER.info(--) RAILS_DEFAULT_LOGGER.info(Finished Extracting data from Teradata (#{Time.now()-start_time} seconds)) RAILS_DEFAULT_LOGGER.info(--) else RAILS_DEFAULT_LOGGER.info(Failed Extracting data from Teradata (#{Time.now()-start_time} seconds) - Error code: #{result}) RAILS_DEFAULT_LOGGER.info(Output from FastExport:\n#{output}) raise(ERROR: Export of Table #{teradata_table_name} failed - Error Code #{result}.) end return end -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/G3xDSOMpEq0J. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
[Rails] Re: Update XML file from another XML file
Hi Paul, I read your post this morning as I'm setting out to achieve exactly the same objective - updating Shopify with inventory levels from a remote XML (wholesale) feed. I've got a ROR Shopify app up and running so am set with the authentication side. Would be really keen to hear how you got on with your project and whether you'd be able to offer any advice. Many thanks, David -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
[Rails] installing gems on
Hi I am working in a linux ruby rails environment and would like to install some gems but ensure that i they only work within my branch of the code and are not put into the gem path so that they are visible to everyone else How can I do this? my current gem env is [ta84@ukird135 ~/projects/RB-3.7-dev01]$ gem env RubyGems Environment: - RUBYGEMS VERSION: 1.3.6 - RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [i686-linux] - INSTALLATION DIRECTORY: /appl/apache/dev/development/ruby/lib/ruby/gems/1.8 - RUBY EXECUTABLE: /appl/apache/dev/development/ruby/bin/ruby - EXECUTABLE DIRECTORY: /appl/apache/dev/development/ruby/bin - RUBYGEMS PLATFORMS: - ruby - x86-linux - GEM PATHS: - /appl/apache/dev/development/ruby/lib/ruby/gems/1.8 - /home/ta84/.gem/ruby/1.8 - GEM CONFIGURATION: - :update_sources = true - :verbose = true - :benchmark = false - :backtrace = false - :bulk_threshold = 1000 - REMOTE SOURCES: - http://rubygems.org/ [ta84@ukird135 ~/projects/RB-3.7-dev01]$ Gurdipe -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/qh6Uhz9SqlQJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
Re: [Rails] installing gems on
On 29 June 2012 09:42, Gurdipe Dosanjh rhomobilea...@gmail.com wrote: Hi I am working in a linux ruby rails environment and would like to install some gems but ensure that i they only work within my branch of the code and are not put into the gem path so that they are visible to everyone else Use rvm, then each user and rails app can have a different set of gems https://rvm.io In fact it is highly recommended to use rvm anyway. Colin -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
[Rails] Re: explanation required on def method = (.)
please try http://ruby.railstutorial.org 在 2012年6月27日星期三UTC-7下午12时50分52秒,Ruby-Forum.com User写道: thanks for the link, i've bought some RoR books to get further info, but if you have some websites with some easy to use examples for a beginner am most welcome to accept them :) -- 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 view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/w0PdcuE8rLIJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
[Rails] Ruby On Rails Loco Team?
I've been thinking to build a local team for Tunisians Rails developers, and I'm wondering if there are officials loco teams for Ruby On Rails? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/2Ve5xTgr3L0J. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
[Rails] Default scope on associations
Hi all, Recently i am upgrading one of my rails app to 3.2.6. It seems the dafault_scope with options has been deprecated. i have a scope like this default_scope :include = [:campaign, :site], :order = :'sites.name' in a relational model campaign_site which giving this error Mysql2::Error: Unknown column 'sites.name' in 'order clause': SELECT `campaigns`.* FROM `campaigns` INNER JOIN `campaign_sites` ON `campaigns`.`id` = `campaign_sites`.`campaign_id` WHERE `campaign_sites`.`site_id` = 11377 ORDER BY campaigns.name, sites.name Any idea how to get around this? Thanks in advance! -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/zdecvl86inwJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
[Rails] Re: will_change!
Hi Colin Law it's very good explanation! thank very much !!! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
Re: [Rails] Default scope on associations
Perception 1: I'm not sure but according to the Sql Query that you put here it seems that there's a table in your application database called campaign_sites not sites (or maybe you have another table sites which can't be perceived from this report here or you're doing kind of an aliasing or something!) and if you wanted to order by the name of a campaign site I think you should change the sites.name to campaign_sites.name Because this query seems straightforward you joined the campaign and campaign_site on the campaign_id (according to your has_many|belongs_to association) and then you want the result to be ordered by campaign_site's name I guess. Perception 2: The other perception here form the Sql Query and more specifically the part - campaign_sites.site_id = 11377 is that site_id is a foreign key to a sites table in your campaign_sites table and if that's the case because you didn't include the sites table in your JOIN mechanism then it can't find sites.name cause there is no sites in the query join result from your tables. (you only have tables - campaigns and campaign_sites in the JOIN) Hope that helps. But I think a little more explanation about your model relationships (campaign, campaign_sites, [sites if there's such a thing]) can be helpful so we can understand the problem better and maybe give you better answers. Good Luck ;) -- Sam Serpoosh Software Developer: http://masihjesus.wordpress.com Twitter @masihjesus http://twitter.com/masihjesus -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
[Rails] Re: Best practice on Javascript and rails
This might not be what you're looking for but I'd start by reading up on the Asset Pipeline http://guides.rubyonrails.org/asset_pipeline.html. Then there are useful railscasts http://railscasts.com/ on both subjects. On Thursday, June 28, 2012 8:03:40 AM UTC-4, Ruby-Forum.com User wrote: Hi, I get constantly nervy whenever trying to implement any javascript / jquery in rails, basically because I'm not sure where to put things in the project! I know the people at rails have thought long and hard about how to best structure an app, so I'd like to learn the correct way. I'm using rails 3.2, ruby 1.9.3 / 1st situation - using a gem to include a javascript package : By default now I notice this is included in the gemfile : gem 'jquery-rails' there's also these lines in application.js //= require jquery //= require jquery_ujs and there's this in my layout view %= javascript_include_tag application % do I have to do anything at all to use jQuery in my application? If I want to use some jQuery on a page, where's the place to put it? in the controller.js.coffee? Or on the page between script and /script can I use js / jquery in this strange .coffee file? // 2nd situation - now I want to use JQUery-UI What is the best way to use jQuery UI, and where should I put it. I downloaded the minimised version from jQuery website, but which folder do I put it in? public/...? What am I meant to add to application.js? and do I need to add anything extra to the layout? // 3rd Situation - now I want to use the jQuery-ui CSS to make it look nice Do I link to the online page at http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/base/jquery-ui.css in my layout, pulling in the css dynamically or copy and paste that to a file and include it in the project? if I include this in the project where do I put it? Do I need to add anything to application.css, and or my layout? That's enough for now! I know these questions might seem a bit pointless, but I want to know the right way to do this. I had an app looking and functioning perfectly on my local system, but then when I uploaded it to heroku all jquery-ui stuff and some of the css didn't work, even after a 'rake assets:precompile' I've now got a project with lots of extra includes, and js / css files repeated in different places just to get it to work on heroku. Very annoying, and I'm sure if I just knew the right way to organise everything it'd be much easier. Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/4imuFJ-xuKkJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
Re: [Rails] Activeresource locking
On Jun 28, 2012, at 9:38 PM, narayana perla wrote: Hi, I have a scenario where a row in a DB can be updated by multiple activeresource clients. Is there a way to lock a row in active resource ? Have you read this? http://www.engineyard.com/blog/2011/a-guide-to-optimistic-locking/ Walter -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
[Rails] Re: Fastest way to find the total length of your postgres query
On Jun 29, 4:25 am, Tom Choi li...@ruby-forum.com wrote: Hello, I know in ruby that when you want to find the size of your query say [1,2,3,4,5,6] would provide 6 as the total size, length, or even count. When I try to use size, length, or count on my application, I would get a pretty darn slow performance (takes around 10 seconds to load each count and I do it twice). Is there another faster way to get the total size from the postgres query? on an active record scope (which includes associations) - length will always force all the results to be loaded and then the length of the array is returned - count will do a select count(*) - size will either use the length of the array if it is loaded or do a count(*) if not So using length if you don't actually want all the objects loaded will be way slower. if a simple count is that slow then you probably want to look at your database indexes - use explain from the psql console to find out how it is running your query (on rails 3.2 active record will do this for you if you've turned on auto explains) Fred I am using this kind of format in database e.g: table population [id, race id] table race [id, persons id] table persons[id, likes] so if I use population.race.persons.count I would get the total size of the persons in that particular race and population. -- 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-talk@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-US.
[Rails] Re: Best practice on Javascript and rails
On Jun 28, 1:03 pm, Michael Baldock li...@ruby-forum.com wrote: Hi, I get constantly nervy whenever trying to implement any javascript / jquery in rails, basically because I'm not sure where to put things in the project! I know the people at rails have thought long and hard about how to best structure an app, so I'd like to learn the correct way. I'm using rails 3.2, ruby 1.9.3 / 1st situation - using a gem to include a javascript package : By default now I notice this is included in the gemfile : gem 'jquery-rails' there's also these lines in application.js //= require jquery //= require jquery_ujs and there's this in my layout view %= javascript_include_tag application % do I have to do anything at all to use jQuery in my application? If I want to use some jQuery on a page, where's the place to put it? in the controller.js.coffee? Or on the page between script and /script can I use js / jquery in this strange .coffee file? coffeescript compiles to javascript. If you don't want to use coffee script (I'd give it a go if I were you) rename controller.js.coffee to just controller.js. Be aware that (by default at least) all of those js files will be loaded together, so make sure the code you write there won't interfere with pages it's not supposed to act on (it's up to you to come up with something to handle this) // 2nd situation - now I want to use JQUery-UI What is the best way to use jQuery UI, and where should I put it. I downloaded the minimised version from jQuery website, but which folder do I put it in? public/...? What am I meant to add to application.js? and do I need to add anything extra to the layout? // 3rd Situation - now I want to use the jQuery-ui CSS to make it look nice I use the gem 'jquery-ui-rails' for the last 2. As you might imagine it vendors jquery ui but it splits it up so that you only load the components you need, i.e. you can stick in your application.js //= require jquery.ui.tabs and it will only load that bit (it knows about dependencies and will pull in whatever bits of jquery-ui are needed to make ui.tabs work. This gem does the same for stylesheets too, you can add /* *= require jquery.ui.tabs *= require jquery.ui.slider */ to your css manifest to only include those bits. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
[Rails] edit a collection item in _form for the parent
Say I have a Dog that has_may legs (In this case we don't care how many). In the _form for Dog, I would like to assign a pre-existing let to him. I would like to do something like this: %= f.collection_select :leg_1, Leg.select { |l| l.dog_id == nil }, :id, :description % %= f.collection_select :leg_2, Leg.select { |l| l.dog_id == nil }, :id, :description % Then in my controller's create action: @dog = Dog.new(params[:dog]) @dog.save leg = Leg.find(params[:leg_1]) leg.dog = @dog leg.save The problem is that the collection_select is trying to set the leg_1 value as part of Dog, which of course does not exist. Do I need to create 'view model' for doing this? Thanks, ~S -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/L0hQFvIaEFgJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
[Rails] Re: Activeresource locking
Thanks alot for the pointer :) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
[Rails] Dropdown menus
Environment: Rails 3.2.3 This is my first attempt at doing a dropdown menu in a Rails application. I tried looking for help on the topic, but what complicated things is that the term dropdown menu is used for actual dropdown menu (page menu), as well as what is dropdown lists, form options, form selections, etc. I found a pointer to https://github.com/dkeskar/rails-jquery-dropdown, and following the instructions, I downloaded jquery_dropdown_helper.rb: ) and placed it in /lib In my Gemfile, I have the following: gem 'jquery-rails' I downloaded jquery_dropdown_helper.rb: https://github.com/dkeskar/rails-jquery-dropdown) and placed it in /lib In _header.html.erb, I have the following: % require 'jquery_dropdown_helper' % %= hidden_field_tag :sort_criteria % %= dropdown_tags :sort_criteria, 'Select Criteria', %w(Category Status Amount-High Amount-Low) % Here's the error code I'm getting: undefined method `gsub' for :sort_criteria:Symbol Any ideas? Attached is the jquery_dropdown_helper.rb Attachments: http://www.ruby-forum.com/attachment/7541/jquery_dropdown_helper.rb -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
[Rails] Prob with updating a record with Activeresource object
Hi, I am updating a record using activeresource object. I get an error cant mass assign protected attributes id, created_at , updated_at. This is because i read a record, modify some values and then update the entry using object.save( which also updates id, created_at etc). To remove this error i can include the id, created_at fields in the model file. But is there a better way to get out of this prob? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
[Rails] Rspec - want to NOT clear database between tests
Rails 3.2.1 Ruby 1.9.3p125 Rspec 2.8.0 I have a utility written in ruby that executes within a Rails environment. It creates database records in one table based on the info in other tables. A date and a name determine uniqueness of these created records. To test this, I have to run the utility giving it date parameters for a year + 4 days and then, for each test, test to see if each of 34 records has or has not been created according to a spreadsheet that contains the expected result. The utility creates records according to a number of different algorithms so that, for example, on the 21st of the month it may create a record for the 19th and another for the 31st, so it's not feasible to run this on a day-by-day basis. The thing is, I don't want to have to run the utility inside every test - it takes several minutes for each run and there will be 34 x 366 tests (plus a few extras). So, I run the utility and then, when I execute the first test, I discover that the records created by the utility are gone and the database contains just the fixtures data. Roughly, I have: describe comprehensive test do context all year do utility to extract infrastructure data from dev database code to symlink a yaml file with one or another mutually exclusive seed records fixtures :all execute utility for 2012-01-01 to 2013-01-05 it should have more than the seed records in the table examined do Table.all.count.should be 2 # number of seed records end each day, each identifier, try to retrieve record and check against 0 or 1 on the corresponding spreadsheet entry end context already existing records do empty database code to symlink the other yaml file into a fixture fixtures :all execute utility for 2012-05-31 only test that a specific 6 records have not been created end end One test actually implemented and it fails. The one test will be followed by complex looping code reading the spreadsheet and requesting the corresponding record and either it should be there or it shouldn't. That's over 12,000 tests because not creating a record when it shouldn't be there is as important as creating it when it should. And then there's the second context... Running a single month is not sufficient because holidays, days of the week, first and last days of the month figure in for different record creation algorithms. But I can't get past this one test. How do I stop rspec from clearing the relevant table before the test? I watch the records I want being created, but then the db is restored to just the fixtures. Note that I could have done this in shell in about 1/2 day but I've been ordered to do this in the rspec framework. I feel like I'm building a blivet here (10 pounds of ... slop in a 5-lb bag). Please someone help? Otherwise I will just have to write the shell script and call it from rspec :( TIA -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.
Re: [Rails] jquery not working in production?
On Wednesday, June 27, 2012 12:54:41 PM UTC-4, Ylan wrote: On Jun 27, 2012, at 9:42 AM, Vell wrote: The error you are getting means that, when running the rake task the jquery gem is not available. There are a few ways this can happen: Did you add the jquery gem only in the development group? In the asset group? jquery rails is in the assets group of my gemfile Did you remember to run bundle install after adding the gem? Yes I did run bundle install after adding the gym. What bundler groups are available in which environments (look into your application.rb file). I am not sure I am looking in the right place in my application.rb file but here is what I saw at the top of the file: if defined?(Bundler) # If you precompile assets before deploying to production, use this line Bundler.require(*Rails.groups(:assets = %w(development test))) # If you want your assets lazily compiled in production, use this line # Bundler.require(:default, :assets, Rails.env) end If answering the above questions doesn't lead you to find the problem, post back your complete Gemfile and we will go from there. Here is what my gemfile looks like: [snip] I don't see any obvious errors there, and I am assuming that you already checked line 13 of application.js for correctness. At this point, I am out of ideas on where the problem is. If I where you, I would start a blank rails application in which you *can* precompile the assets. Then starts looking for potential differences between the brand new app and yours. So I did end up resolving this issue. There were 2 issues. 1. jquery-rails doesn't like being in the assets block of my Gemfile. Once I took it out of that block I was able to compile in production without any error. I happened to be passing through railscast and saw that one of Ryan Bates examples had that particular line under the assets block. 2. I had an error in one of my .js files so removed the file and everything seems to be working as expected. I will see if I can figure out what is going on with that .js file at a later date. Thanks for the help in trying to get me to solve this issue. Sorry, I can't be of more help. -- Ylan -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/PrE1Kr1OuyIJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.